How to use the ws.Server.call function in ws

To help you get started, we’ve selected a few ws 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 christian-raedel / nightlife-rabbit / lib / nightlife / router.js View on Github external
server = http.createServer(function (req, res) {
            res.writeHead(404);
            res.end();
        });
    }

    server.on('error', function (err) {
        logger.error('httpServer error:', err.stack);
    });

    var port = config.getValue('port');
    server.listen(port, function () {
        logger.info('bound and listen at:', port);
    });

    WebSocketServer.call(self, {
        'server' : server,
        'path'   : config.getValue('path')
    });

    self.on('error', function (err) {
        logger.error('webSocketServer error:', err.stack);
    });

    self.on('connection', function (socket) {
        logger.info('incoming socket connection');

        var session = new Session(socket, self.roles);

        session.on('attach', function (realm, defer) {
            try {
                logger.debug('attaching session to realm', realm);
github christian-raedel / nightlife-rabbit / lib / router.js View on Github external
res.end('This is the Nightlife-Rabbit WAMP transport. Please connect over WebSocket!');
        });
    }

    server.on('error', function (err) {
        logger.error('httpServer error:', err.stack);
    });

    var port = config.getValue('port');
    if (port) {
        server.listen(port, function () {
            logger.info('bound and listen at:', port);
        });
    }

    WebSocketServer.call(self, {
        'server' : server,
        'path'   : config.getValue('path')
    });

    self.on('error', function (err) {
        logger.error('webSocketServer error:', err.stack);
    });

    self.on('connection', function (socket) {
        logger.info('incoming socket connection');

        var session = new Session(socket, self.roles);

        session.on('attach', function (realm, defer) {
            try {
                logger.debug('attaching session to realm', realm);

ws

Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js

MIT
Latest version published 6 months ago

Package Health Score

89 / 100
Full package analysis