mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-21 22:32:41 +01:00
Update AphlictClientServer to support ws2 or ws3
Summary: This lets us support either ws2 or ws3. Fixes T12755 Test Plan: Update server to version 3, send message, watch debug log. Downgrade to 2.x, send messages, watch debug log. Everything seems OK Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T12755 Differential Revision: https://secure.phabricator.com/D18411
This commit is contained in:
parent
77bf245637
commit
3b14c1fdd1
1 changed files with 8 additions and 2 deletions
|
@ -92,8 +92,14 @@ JX.install('AphlictClientServer', {
|
||||||
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);
|
||||||
|
|
Loading…
Reference in a new issue