forked from websockets/ws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
26 lines (23 loc) · 815 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*!
* ws: a node.js websocket client
* Copyright(c) 2011 Einar Otto Stangvik <[email protected]>
* 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;
};