- })
-
- this.ws.enable('browser client minification');
- this.ws.enable('browser client etag');
- this.ws.set('transports', transports);
- this.ws.set('resource', (global.config.http_base_path || '') + '/transport');
-
- this.ws.of('/kiwi').authorization(authoriseConnection)
- .on('connection', function () {
- newConnection.apply(that, arguments);
- }
- );
- this.ws.of('/kiwi').on('error', console.log);
+ });
+
+ this.ws = engine.attach(hs, {
+ transports: ['websocket', 'polling', 'flashsocket'],
+ path: (global.config.http_base_path || '') + '/transport'
+ });
+
+ this.ws.on('connection', function(socket) {
+ initialiseSocket(socket, function(err, authorised) {
+ var client;
+
+ if (!authorised) {
+ socket.close();
+ return;
+ }
+
+ client = new Client(socket);
+ client.on('dispose', function () {
+ that.emit('client_dispose', this);
+ });
+
+ that.emit('connection', client);
+
+ // Call any modules listening for new clients
+ global.modules.emit('client created', {client: client});
+ });
+ });