Fix WebSocket server not starting on Windows

Summary: When Flipper starts with Flipper Server enabled, on Windows we forgot to attach the WebSocket handler. It led to a white screen on Electron or to connection timeout messages on Flipper Server.

Reviewed By: passy, lblasa

Differential Revision: D40679781

fbshipit-source-id: 1c8df8012efc54077409eb8891b1d82ddaf16689
This commit is contained in:
Andrey Goncharov
2022-10-26 03:36:04 -07:00
committed by Facebook GitHub Bot
parent 13e06803c9
commit 3e88a53a3f
2 changed files with 21 additions and 10 deletions

View File

@@ -110,14 +110,17 @@ async function startProxyServer(
// listening at the specified port.
if (os.platform() === 'win32') {
if (!config.tcp) {
console.error(
'No port was supplied and domain socket access is not available for non-POSIX systems, unable to start server',
console.warn(
'No port was supplied and domain socket access is not available for non-POSIX systems, falling back to TCP',
);
process.exit(1);
}
return new Promise((resolve) => {
console.log(`Starting server on http://localhost:${config.port}`);
const readyForIncomingConnections = (): Promise<void> => {
const readyForIncomingConnections = (
serverImpl: FlipperServerImpl,
companionEnv: FlipperServerCompanionEnv,
): Promise<void> => {
attachSocketServer(socket, serverImpl, companionEnv);
return new Promise((resolve) => {
server.listen(config.port, undefined, () => resolve());
});