Skip to content

Commit 91f3c07

Browse files
committed
[minor] Replace echo.websocket.org with websocket-echo.com
The echo.websocket.org service is no longer available.
1 parent ad3fe6d commit 91f3c07

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

README.md

+6-10
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ can use one of the many wrappers available on npm, like
3333
- [Multiple servers sharing a single HTTP/S server](#multiple-servers-sharing-a-single-https-server)
3434
- [Client authentication](#client-authentication)
3535
- [Server broadcast](#server-broadcast)
36-
- [echo.websocket.org demo](#echowebsocketorg-demo)
36+
- [Round-trip time](#round-trip-time)
3737
- [Use the Node.js streams API](#use-the-nodejs-streams-api)
3838
- [Other examples](#other-examples)
3939
- [FAQ](#faq)
@@ -324,14 +324,12 @@ wss.on('connection', function connection(ws) {
324324
});
325325
```
326326

327-
### echo.websocket.org demo
327+
### Round-trip time
328328

329329
```js
330330
import WebSocket from 'ws';
331331

332-
const ws = new WebSocket('wss://echo.websocket.org/', {
333-
origin: 'https://websocket.org'
334-
});
332+
const ws = new WebSocket('wss://websocket-echo.com/');
335333

336334
ws.on('open', function open() {
337335
console.log('connected');
@@ -343,7 +341,7 @@ ws.on('close', function close() {
343341
});
344342

345343
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`);
347345

348346
setTimeout(function timeout() {
349347
ws.send(Date.now());
@@ -356,9 +354,7 @@ ws.on('message', function message(data) {
356354
```js
357355
import WebSocket, { createWebSocketStream } from 'ws';
358356

359-
const ws = new WebSocket('wss://echo.websocket.org/', {
360-
origin: 'https://websocket.org'
361-
});
357+
const ws = new WebSocket('wss://websocket-echo.com/');
362358

363359
const duplex = createWebSocketStream(ws, { encoding: 'utf8' });
364360

@@ -457,7 +453,7 @@ function heartbeat() {
457453
}, 30000 + 1000);
458454
}
459455

460-
const client = new WebSocket('wss://echo.websocket.org/');
456+
const client = new WebSocket('wss://websocket-echo.com/');
461457

462458
client.on('open', heartbeat);
463459
client.on('ping', heartbeat);

test/websocket.integration.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ const WebSocket = require('..');
66

77
describe('WebSocket', () => {
88
it('communicates successfully with echo service (ws)', (done) => {
9-
const ws = new WebSocket('ws://echo.websocket.org/', {
10-
origin: 'http://www.websocket.org',
9+
const ws = new WebSocket('ws://websocket-echo.com/', {
1110
protocolVersion: 13
1211
});
1312
const str = Date.now().toString();
@@ -27,8 +26,7 @@ describe('WebSocket', () => {
2726
});
2827

2928
it('communicates successfully with echo service (wss)', (done) => {
30-
const ws = new WebSocket('wss://echo.websocket.org/', {
31-
origin: 'https://www.websocket.org',
29+
const ws = new WebSocket('wss://websocket-echo.com/', {
3230
protocolVersion: 13
3331
});
3432
const str = Date.now().toString();

test/websocket.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('WebSocket', () => {
3333
);
3434

3535
assert.throws(
36-
() => new WebSocket('https://echo.websocket.org'),
36+
() => new WebSocket('https://websocket-echo.com'),
3737
/^SyntaxError: The URL's protocol must be one of "ws:", "wss:", or "ws\+unix:"$/
3838
);
3939

@@ -43,7 +43,7 @@ describe('WebSocket', () => {
4343
);
4444

4545
assert.throws(
46-
() => new WebSocket('wss://echo.websocket.org#foo'),
46+
() => new WebSocket('wss://websocket-echo.com#foo'),
4747
/^SyntaxError: The URL contains a fragment identifier$/
4848
);
4949
});

0 commit comments

Comments
 (0)