Skip to content

Commit 80769b1

Browse files
committed
[tests] Handle different local IPs
1 parent 8b35368 commit 80769b1

File tree

1 file changed

+5
-2
lines changed
  • src/@types/synchronizers/synchronizer-ws-server

1 file changed

+5
-2
lines changed

src/@types/synchronizers/synchronizer-ws-server/docs.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,10 @@
683683
* // On the server:
684684
* const webSocketServer = new WebSocketServer({port: 8047});
685685
* webSocketServer.on('connection', (_, request) => {
686-
* console.log('Client address: ' + request.socket.remoteAddress);
686+
* const clientAddress = request.socket.remoteAddress;
687+
* if (clientAddress == '::1' || clientAddress == '::ffff:127.0.0.1') {
688+
* console.log('Local client connected');
689+
* }
687690
* });
688691
* const server = createWsServer(webSocketServer);
689692
*
@@ -692,7 +695,7 @@
692695
* createMergeableStore(),
693696
* new WebSocket('ws://localhost:8047'),
694697
* );
695-
* // -> 'Client address: ::1'
698+
* // -> 'Local client connected'
696699
*
697700
* synchronizer.destroy();
698701
* server.destroy();

0 commit comments

Comments
 (0)