summaryrefslogtreecommitdiff
path: root/src/client/rz_mesh.js
blob: 698063409c8d9e966a72db393eb1071b7ddf347c (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', 'util', 'model/diff', 'socketio'], function(rz_config, util, model_diff, io) {

    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
    };

});