<reponame>Gbotline/GG<filename>node_modules/thrift-http/node_modules/ws/index.js<gh_stars>0/*!
 * ws: a node.js websocket client
 * Copyright(c) 2011 Einar Otto Stangvik <nnheo@example.com>
 * MIT Licensed
 */

module.exports = require('./lib/WebSocket');
module.exports.Server = require('./lib/WebSocketServer');
module.exports.Sender = require('./lib/Sender');
module.exports.Receiver = require('./lib/Receiver');

module.exports.createServer = function (options, connectionListener) {
  var server = new module.exports.Server(options);
  if (typeof connectionListener === 'function') {
    server.on('connection', connectionListener);
  }
  return server;
};

module.exports.connect = module.exports.createConnection = function (address, openListener) {
  var client = new module.exports(address);
  if (typeof openListener === 'function') {
    client.on('open', openListener);
  }
  return client;
};
