diff --git a/lib/servers/SockJSServer.js b/lib/servers/SockJSServer.js index 782b325a48..c12913a5a7 100644 --- a/lib/servers/SockJSServer.js +++ b/lib/servers/SockJSServer.js @@ -64,7 +64,7 @@ module.exports = class SockJSServer extends BaseServer { // f should be passed the resulting connection and the connection headers onConnection(f) { this.socket.on('connection', (connection) => { - f(connection, connection.headers); + f(connection, connection ? connection.headers : null); }); }