Use uniform Socket message size to avoid disconnects
Summary: During startup the socket connection would close a few times, among others because Scribe dumps 1.3 MB of data after startup, and the maximum payload of `socket.io` defaults to 1MB. This diff changes it to 100MB (the max size used by `ws` library). We know that we need at least > 10 MB, as that is what plugins like Network cap at. Reviewed By: aigoncharov Differential Revision: D33017653 fbshipit-source-id: 1233af6fbdc4b9eed42786ee418cfd6d43b2b433
This commit is contained in:
committed by
Facebook GitHub Bot
parent
accef856fc
commit
3ef1923b29
@@ -35,6 +35,10 @@ export interface ConnectionCtx {
|
||||
request: IncomingMessage;
|
||||
}
|
||||
|
||||
// based on https://github.com/websockets/ws/blob/master/lib/websocket-server.js#L40,
|
||||
// exposed to share with socket.io defaults
|
||||
export const WEBSOCKET_MAX_MESSAGE_SIZE = 100 * 1024 * 1024;
|
||||
|
||||
/**
|
||||
* It serves as a base class for WebSocket based servers. It delegates the 'connection'
|
||||
* event to subclasses as a customisation point.
|
||||
@@ -52,6 +56,7 @@ class ServerWebSocket extends ServerAdapter {
|
||||
const wsServer = new WSServer({
|
||||
server,
|
||||
verifyClient: this.verifyClient(),
|
||||
maxPayload: WEBSOCKET_MAX_MESSAGE_SIZE,
|
||||
});
|
||||
|
||||
// We do not need to listen to http server's `error` because it is propagated to WS
|
||||
|
||||
@@ -26,3 +26,5 @@ export function getGatekeepers(username: string): Record<string, boolean> {
|
||||
}
|
||||
return GKImplementation.allGKs();
|
||||
}
|
||||
|
||||
export {WEBSOCKET_MAX_MESSAGE_SIZE} from './comms/ServerWebSocket';
|
||||
|
||||
Reference in New Issue
Block a user