How to use the sockjs-client.create function in sockjs-client

To help you get started, we’ve selected a few sockjs-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 amark / coalesce / coalesce.js View on Github external
a.list(web.opt.node.src).each(function(url){
						var toe = toes.create(url);
						web.node.cons[url] = toe;
						toe.on('error', function(e){ console.log('ut-oh', e) }); // need to add this before the connection event.
						toe.on('connection', function(){
							toe.writable = true;
							toe.mid = url;
							toe.write(a.text.ify(a.com.meta({
								what: {auth: web.opt.node.key, to: url}
								,where: {mid: web.opt.node.mid}
							})));
							state.con(toe);
						});
					});
				}
github amark / gun / node_modules / coalesce / coalesce.js View on Github external
a.list(web.opt.node.src).each(function(url){
						var toe = toes.create(url);
						web.node.cons[url] = toe;
						toe.on('error', function(e){ console.log('ut-oh', e) }); // need to add this before the connection event.
						toe.on('connection', function(){
							toe.writable = true;
							toe.mid = url;
							toe.write(a.text.ify(a.com.meta({
								what: {auth: web.opt.node.key, to: url}
								,where: {mid: web.opt.node.mid}
							})));
							state.con(toe);
						});
					});
				}
github arunoda / meteor-ddp-analyzer / lib / proxy.js View on Github external
return function(conn) {
    var clientId = ++clientIds;
    console.log(util.format('New Client: [%d]', clientId) + '\n');

    var meteor = sjsc.create('http://localhost:' + meteorPort + '/sockjs');
    closeBrowserConnection = _.once(conn.close.bind(conn));

    conn.on('data', function(message) {
      meteor.write(message);
      printDdp('client', message, clientId);
    });
    conn.on('close', meteor.close);

    meteor.on('data', function(message) {
      conn.write(message);
      printDdp('server', message, clientId);
    });

    meteor.on('error', function() {
      closeBrowserConnection();
      meteor.close();
github Ezelia / eureca.io / src / transport / Sockjs.transport.ts View on Github external
var createClient = function (uri, options: any = {}) {
        var sjsoptions: any = {};
        sjsoptions.prefix = options.prefix ? options.prefix : undefined;


        var socket;
        if (Eureca.Util.isNodejs) {

            socket = require('sockjs-client').create(uri + sjsoptions.prefix);
        } else {
            socket = new SockJS(uri);
        }


        var client = new Socket(socket);

        return client;
    }
    Transport.register('sockjs', '/js/sockjs-0.3.min.js', createClient, createServer);

sockjs-client

SockJS-client is a browser JavaScript library that provides a WebSocket-like object.

MIT
Latest version published 3 years ago

Package Health Score

81 / 100
Full package analysis