compatibility: add node.js example server
This commit is contained in:
parent
5ce1a596cf
commit
a42f115f79
11
test/compatibility/node/echo_server.js
Normal file
11
test/compatibility/node/echo_server.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
const WebSocket = require('ws');
|
||||||
|
|
||||||
|
const wss = new WebSocket.Server({ port: 8080 });
|
||||||
|
|
||||||
|
wss.on('connection', function connection(ws) {
|
||||||
|
ws.on('message', function incoming(message) {
|
||||||
|
console.log('received: %s', message);
|
||||||
|
});
|
||||||
|
|
||||||
|
ws.send('something');
|
||||||
|
});
|
11
test/compatibility/node/echo_server_permessagedeflate.js
Normal file
11
test/compatibility/node/echo_server_permessagedeflate.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
const WebSocket = require('ws');
|
||||||
|
|
||||||
|
const wss = new WebSocket.Server({ port: 8080, perMessageDeflate: true });
|
||||||
|
|
||||||
|
wss.on('connection', function connection(ws) {
|
||||||
|
ws.on('message', function incoming(message) {
|
||||||
|
console.log('received: %s', message);
|
||||||
|
});
|
||||||
|
|
||||||
|
ws.send('something');
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user