How to use the socketcluster-client/index.connect function in socketcluster-client

To help you get started, we’ve selected a few socketcluster-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DragonsInn / BIRD3 / app / Frontend / Communicator.js View on Github external
], (require) => {
            // Socketcluster and rpc layer.
            var SC = require("socketcluster-client/index");
            var SCRPC = require("avs-rpc").scRpc;

            // Connect
            console.log(this)
            this.scConn = SC.connect();
            this.rpc = new SCRPC(this.scConn);

            // Connect the basic events.
            this.scConn.on('error', (err) => {
                console.log("Error:", err);
            });
            this.scConn.on('connect', () => {
                // Logging
                this.scConn.on("client_log", (msg) => {
                    console.log("REMOTE>", msg);
                });

                // RPC
                this.scConn.on("rpc_init_data", (methods) => {
                    //console.log("Methods:",methods);
                    this.rpcr = this.rpc.remote.call(this.rpc, methods);