Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var PushIt = function (server, options) {
EventEmitter.apply(this, arguments);
if(options.help) help();
this.server = server;
if (options.socket){
this.sock = options.socket;
}else{
var sockjs_opts = {sockjs_url: "http://majek.github.com/sockjs-client/sockjs-latest.min.js"};
var sjs_echo = new sjs.Server(sockjs_opts);
sjs_echo.installHandlers(this.server, {prefix:'[/]pi/'});
this.sock = sjs_echo;
}
var self = this;
this.sock.on('open', function (client) {
self.emit('connection', client);
});
if (!options.skipSetupIO) this.setupIO();
this.mq = options.mq || new InMemoryMQ();
this.channels = options.channels || {};
this.subscriptionManager = options.subscriptionManager || new SubscriptionManager(this.mq);
};