Changeset View
Changeset View
Standalone View
Standalone View
support/aphlict/server/lib/AphlictClientServer.js
| Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | _parseInstanceFromPath: function(path) { | ||||
| return instance; | return instance; | ||||
| }, | }, | ||||
| listen: function() { | listen: function() { | ||||
| var self = this; | var self = this; | ||||
| var server = this._server.listen.apply(this._server, arguments); | var server = this._server.listen.apply(this._server, arguments); | ||||
| var wss = new WebSocket.Server({server: server}); | var wss = new WebSocket.Server({server: server}); | ||||
| wss.on('connection', function(ws) { | // This function checks for upgradeReq which is only available in | ||||
| var path = url.parse(ws.upgradeReq.url).pathname; | // ws2 by default, not ws3. See T12755 for more information. | ||||
| wss.on('connection', function(ws, request) { | |||||
| if ('upgradeReq' in ws) { | |||||
| request = ws.upgradeReq; | |||||
| } | |||||
| var path = url.parse(request.url).pathname; | |||||
| var instance = self._parseInstanceFromPath(path); | var instance = self._parseInstanceFromPath(path); | ||||
| var listener = self.getListenerList(instance).addListener(ws); | var listener = self.getListenerList(instance).addListener(ws); | ||||
| function log() { | function log() { | ||||
| self.log( | self.log( | ||||
| util.format('<%s>', listener.getDescription()) + | util.format('<%s>', listener.getDescription()) + | ||||
| ' ' + | ' ' + | ||||
| ▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines | |||||