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:
Michel Weststrate
2021-12-13 05:46:42 -08:00
committed by Facebook GitHub Bot
parent accef856fc
commit 3ef1923b29
4 changed files with 22 additions and 6 deletions

View File

@@ -12,6 +12,7 @@ import http from 'http';
import path from 'path';
import fs from 'fs-extra';
import socketio from 'socket.io';
import {WEBSOCKET_MAX_MESSAGE_SIZE} from 'flipper-server-core';
type Config = {
port: number;
@@ -61,6 +62,8 @@ function startAssetServer(
}
function addWebsocket(server: http.Server) {
const io = new socketio.Server(server);
const io = new socketio.Server(server, {
maxHttpBufferSize: WEBSOCKET_MAX_MESSAGE_SIZE,
});
return io;
}