angular/packages/zone.js/test/ws-server.js
Joey Perrott f307e95459 refactor: migrate zone.js to prettier formatting (#55427)
Migrate formatting to prettier for zone.js from clang-format

PR Close #55427
2024-04-29 09:52:05 -07:00

21 lines
483 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.io/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);
});
});