Skip to content
Snippets Groups Projects
Commit 36f24260 authored by Neil Gershenfeld's avatar Neil Gershenfeld
Browse files

wip

parent 495e0b8f
Branches
No related tags found
No related merge requests found
//
// hello.ws-blink.js
// WebSocket blink hello-world test server
//
// Neil Gershenfeld 11/24/23
//
// This work may be reproduced, modified, distributed,
// performed, and displayed for any purpose, but must
// acknowledge this project. Copyright is retained and
// must be preserved. The work is provided as is; no
// warranty is provided, and users accept all liability.
//
const WebSocketServer = require('ws').Server
const ws = new WebSocketServer({port:12345})
ws.on('connection',function connection(ws) {
console.log('connect')
ws.on('close',function close() {
console.log('close');
ws.send('close');
ws.close()
});
ws.on('message',function message(data) {
console.log('received: %s',data);
ws.send('received "'+data+'"');
});
});
//
// hello.ws-blink.mjs
// WebSocket blink hello-world test
//
// Neil Gershenfeld 11/24/23
//
// This work may be reproduced, modified, distributed,
// performed, and displayed for any purpose, but must
// acknowledge this project. Copyright is retained and
// must be preserved. The work is provided as is; no
// warranty is provided, and users accept all liability.
//
import {WebSocketServer} from 'ws'
const ws = new WebSocketServer({port:12345})
ws.on('connection',function connection(ws) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment