Allow localhost to connect to websocket

Summary: Accept websocket connections from any localhost origin, in addition to the existing chrome extensions support.

Reviewed By: jknoxville

Differential Revision: D20792131

fbshipit-source-id: d3991aa375bfb4e6f492c02dfab9bf72b1f8c412
This commit is contained in:
Roi Becker
2020-04-06 04:48:17 -07:00
committed by Facebook GitHub Bot
parent 83fd17898f
commit 36f1b0e9c2

View File

@@ -159,7 +159,10 @@ class Server extends EventEmitter {
req: IncomingMessage;
secure: boolean;
}) => {
return info.origin.startsWith('chrome-extension://');
return (
info.origin.startsWith('chrome-extension://') ||
info.origin.startsWith('localhost:')
);
},
});
wss.on('connection', (ws: WebSocket, message: any) => {