summaryrefslogtreecommitdiff
path: root/src/client/rz_mesh.js
blob: 89c75c7c060e2a47ec9785cca377fe4655e7cae1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
    };

});