Created
August 4, 2016 18:21
-
-
Save Zensey/04d3964f4cb8d54215ac4c3a12ca7a13 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function *noop(){} | |
Ws.prototype.onConnection = function *(client) { | |
try { | |
var ctx = this.web.koa_app.createContext(client.upgradeReq, {statusCode: null}); | |
yield this.web.session_.bind(ctx)(noop); | |
var sessionId = ctx.sessionId; | |
this.logger.info("WebSocket.onConnection", sessionId); | |
... | |
} | |
... | |
} | |
... | |
Ws.prototype.init = function *() { | |
var wss = new WebSocketServer({server: this.koa.httpsServer}); | |
wss.on('connection', co.wrap(this.onConnection).bind(this)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment