wormhole/example/example.js

14 lines
309 B
JavaScript
Raw Normal View History

const http = require('http');
2021-01-26 12:04:53 +02:00
const Wormhole = require('../index');
const httpServer = http.createServer();
const wormhole = new Wormhole({ urls: [ '/hello' ], httpServer });
wormhole.on('connect', ({ socket, accept, reject }) => {
accept();
socket.sendText('hello');
});
httpServer.listen(8080);