@@ -33,7 +33,7 @@ can use one of the many wrappers available on npm, like
33
33
- [ Multiple servers sharing a single HTTP/S server] ( #multiple-servers-sharing-a-single-https-server )
34
34
- [ Client authentication] ( #client-authentication )
35
35
- [ Server broadcast] ( #server-broadcast )
36
- - [ echo.websocket.org demo ] ( #echowebsocketorg-demo )
36
+ - [ Round-trip time ] ( #round-trip-time )
37
37
- [ Use the Node.js streams API] ( #use-the-nodejs-streams-api )
38
38
- [ Other examples] ( #other-examples )
39
39
- [ FAQ] ( #faq )
@@ -324,14 +324,12 @@ wss.on('connection', function connection(ws) {
324
324
});
325
325
```
326
326
327
- ### echo.websocket.org demo
327
+ ### Round-trip time
328
328
329
329
``` js
330
330
import WebSocket from ' ws' ;
331
331
332
- const ws = new WebSocket (' wss://echo.websocket.org/' , {
333
- origin: ' https://websocket.org'
334
- });
332
+ const ws = new WebSocket (' wss://websocket-echo.com/' );
335
333
336
334
ws .on (' open' , function open () {
337
335
console .log (' connected' );
@@ -343,7 +341,7 @@ ws.on('close', function close() {
343
341
});
344
342
345
343
ws .on (' message' , function message (data ) {
346
- console .log (` Roundtrip time: ${ Date .now () - data} ms` );
344
+ console .log (` Round-trip time: ${ Date .now () - data} ms` );
347
345
348
346
setTimeout (function timeout () {
349
347
ws .send (Date .now ());
@@ -356,9 +354,7 @@ ws.on('message', function message(data) {
356
354
``` js
357
355
import WebSocket , { createWebSocketStream } from ' ws' ;
358
356
359
- const ws = new WebSocket (' wss://echo.websocket.org/' , {
360
- origin: ' https://websocket.org'
361
- });
357
+ const ws = new WebSocket (' wss://websocket-echo.com/' );
362
358
363
359
const duplex = createWebSocketStream (ws, { encoding: ' utf8' });
364
360
@@ -457,7 +453,7 @@ function heartbeat() {
457
453
}, 30000 + 1000 );
458
454
}
459
455
460
- const client = new WebSocket (' wss://echo.websocket.org /' );
456
+ const client = new WebSocket (' wss://websocket- echo.com /' );
461
457
462
458
client .on (' open' , heartbeat);
463
459
client .on (' ping' , heartbeat);
0 commit comments