mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
21 lines
484 B
JavaScript
21 lines
484 B
JavaScript
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.dev/license
|
|
*/
|
|
|
|
const {WebSocketServer} = require('ws');
|
|
|
|
// simple echo server
|
|
const wss = new WebSocketServer({port: 8001});
|
|
wss.on('connection', (ws) => {
|
|
ws.on('message', (data) => {
|
|
if (data.toString() === 'close') {
|
|
wss.close();
|
|
return;
|
|
}
|
|
ws.send(data);
|
|
});
|
|
});
|