-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.js
27 lines (22 loc) · 768 Bytes
/
main.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
27
const net = require('net'),
util = require('util'),
events = require('events'),
uuid = require('uuid');
const Server = require("./Server");
const Connection = require("./Connection");
module.exports.createConnection = function(options, cb) {
var connection = new Connection();
if (cb) connection.on("connect", cb);
connection.connect(options);
return connection;
}
module.exports.createServer = function(options, connectionListener) {
// Right now options are not used, only provided for compatibility with the net module
if (typeof options == 'function') {
connectionListener = options;
options = {};
}
var server = new Server();
if (connectionListener) server.on("connection", connectionListener);
return server;
}