From e4be5638c188824e82a5bbd7641a386e2fba39f4 Mon Sep 17 00:00:00 2001 From: LV-426 Date: Sun, 28 Dec 2014 17:28:26 +0200 Subject: initial rz_mesh.js module --- src/client/rz_mesh.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/client/rz_mesh.js (limited to 'src') diff --git a/src/client/rz_mesh.js b/src/client/rz_mesh.js new file mode 100644 index 00000000..89c75c7c --- /dev/null +++ b/src/client/rz_mesh.js @@ -0,0 +1,29 @@ +"use strict" + +/** + * Manage backend websocket connection + */ +define([ 'rz_config' ], function(rz_config) { + + var rz_server_url = 'http://' + rz_config.rz_server_host + ':' + + rz_config.rz_server_port; + + function init() { + var socket = io.connect(rz_server_url + '/graph', { + 'reconnection' : true, // TODO: limit reconnection attempts + 'reconnectionDelay': 3000, + }); + + // wire up event handlers + socket.on('diff_commit__topo', diff_merge__topo); + } + + function diff_merge__topo(topo_diff) { + console.log('ws: rx: diff_merge__topo') + } + + return { + init : init + }; + +}); -- cgit v1.3.1