How to use the websocket.request.prototype function in websocket

To help you get started, we’ve selected a few websocket 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 FE-Kits / Holo-Web / server / modules / websocket-compat.js View on Github external
* by C. Scott Ananian  2014-08-26
 *
 * Based on https://gist.github.com/toshirot/1428579
 */
var events = require("events");
var util = require("util");

var WebSocketRequest = require('websocket').request;
var WebSocketServer = require('websocket').server;

// Copy helpers from WebSocketServer to WebSocketRequest

WebSocketRequest.prototype.connections = [];
WebSocketRequest.prototype.handleRequestAccepted =
  WebSocketServer.prototype.handleRequestAccepted;
WebSocketRequest.prototype.handleConnectionClose =
  WebSocketServer.prototype.handleConnectionClose;
WebSocketRequest.prototype.broadcastUTF =
  WebSocketServer.prototype.broadcastUTF;

var miksagoServerFactory = require('websocket-server');
var miksagoConnection = require('./node_modules/websocket-server/lib/ws/connection');

var CompatWebSocketServer = function(options) {
  events.EventEmitter.call(this); // superclass constructor
  var self = this;
  var handleConnection;

  // node-websocket-server (hixie-75 and hixie-76 support)
  var miksagoServer = miksagoServerFactory.createServer();
  miksagoServer.server = options.httpServer;
  miksagoServer.addListener('connection', function(connection) {
github FE-Kits / Holo-Web / server / modules / websocket-compat.js View on Github external
* Based on https://gist.github.com/toshirot/1428579
 */
var events = require("events");
var util = require("util");

var WebSocketRequest = require('websocket').request;
var WebSocketServer = require('websocket').server;

// Copy helpers from WebSocketServer to WebSocketRequest

WebSocketRequest.prototype.connections = [];
WebSocketRequest.prototype.handleRequestAccepted =
  WebSocketServer.prototype.handleRequestAccepted;
WebSocketRequest.prototype.handleConnectionClose =
  WebSocketServer.prototype.handleConnectionClose;
WebSocketRequest.prototype.broadcastUTF =
  WebSocketServer.prototype.broadcastUTF;

var miksagoServerFactory = require('websocket-server');
var miksagoConnection = require('./node_modules/websocket-server/lib/ws/connection');

var CompatWebSocketServer = function(options) {
  events.EventEmitter.call(this); // superclass constructor
  var self = this;
  var handleConnection;

  // node-websocket-server (hixie-75 and hixie-76 support)
  var miksagoServer = miksagoServerFactory.createServer();
  miksagoServer.server = options.httpServer;
  miksagoServer.addListener('connection', function(connection) {
    // Add remoteAddress property
    connection.remoteAddress = connection._socket.remoteAddress;
github FE-Kits / Holo-Web / server / modules / websocket-compat.js View on Github external
*
 * This file released into the public domain
 * by C. Scott Ananian  2014-08-26
 *
 * Based on https://gist.github.com/toshirot/1428579
 */
var events = require("events");
var util = require("util");

var WebSocketRequest = require('websocket').request;
var WebSocketServer = require('websocket').server;

// Copy helpers from WebSocketServer to WebSocketRequest

WebSocketRequest.prototype.connections = [];
WebSocketRequest.prototype.handleRequestAccepted =
  WebSocketServer.prototype.handleRequestAccepted;
WebSocketRequest.prototype.handleConnectionClose =
  WebSocketServer.prototype.handleConnectionClose;
WebSocketRequest.prototype.broadcastUTF =
  WebSocketServer.prototype.broadcastUTF;

var miksagoServerFactory = require('websocket-server');
var miksagoConnection = require('./node_modules/websocket-server/lib/ws/connection');

var CompatWebSocketServer = function(options) {
  events.EventEmitter.call(this); // superclass constructor
  var self = this;
  var handleConnection;

  // node-websocket-server (hixie-75 and hixie-76 support)
  var miksagoServer = miksagoServerFactory.createServer();
github FE-Kits / Holo-Web / server / modules / websocket-compat.js View on Github external
* presumably, very old browsers).
 *
 * This file released into the public domain
 * by C. Scott Ananian  2014-08-26
 *
 * Based on https://gist.github.com/toshirot/1428579
 */
var events = require("events");
var util = require("util");

var WebSocketRequest = require('websocket').request;
var WebSocketServer = require('websocket').server;

// Copy helpers from WebSocketServer to WebSocketRequest

WebSocketRequest.prototype.connections = [];
WebSocketRequest.prototype.handleRequestAccepted =
  WebSocketServer.prototype.handleRequestAccepted;
WebSocketRequest.prototype.handleConnectionClose =
  WebSocketServer.prototype.handleConnectionClose;
WebSocketRequest.prototype.broadcastUTF =
  WebSocketServer.prototype.broadcastUTF;

var miksagoServerFactory = require('websocket-server');
var miksagoConnection = require('./node_modules/websocket-server/lib/ws/connection');

var CompatWebSocketServer = function(options) {
  events.EventEmitter.call(this); // superclass constructor
  var self = this;
  var handleConnection;

  // node-websocket-server (hixie-75 and hixie-76 support)