Websocket: unhandle rejection (#6418)
* Websocket: unhandle rejection Closes: https://github.com/parse-community/parse-server/issues/6413, https://github.com/parse-community/parse-server/issues/6173 Prevent crashing on websocket error. Bonus points to anybody who can post a specific payload that the client sends that returns an error. * log the socket * fix tests * fix payload reference link
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
const {
|
||||
ParseWebSocketServer,
|
||||
} = require('../lib/LiveQuery/ParseWebSocketServer');
|
||||
const EventEmitter = require('events');
|
||||
|
||||
describe('ParseWebSocketServer', function() {
|
||||
beforeEach(function(done) {
|
||||
// Mock ws server
|
||||
const EventEmitter = require('events');
|
||||
|
||||
const mockServer = function() {
|
||||
return new EventEmitter();
|
||||
};
|
||||
@@ -22,11 +23,11 @@ describe('ParseWebSocketServer', function() {
|
||||
onConnectCallback,
|
||||
{ websocketTimeout: 5 }
|
||||
).server;
|
||||
const ws = {
|
||||
readyState: 0,
|
||||
OPEN: 0,
|
||||
ping: jasmine.createSpy('ping'),
|
||||
};
|
||||
const ws = new EventEmitter();
|
||||
ws.readyState = 0;
|
||||
ws.OPEN = 0;
|
||||
ws.ping = jasmine.createSpy('ping');
|
||||
|
||||
parseWebSocketServer.onConnection(ws);
|
||||
|
||||
// Make sure callback is called
|
||||
|
||||
Reference in New Issue
Block a user