const http = require('http'); const Wormhole = require('../index'); const httpServer = http.createServer(); const wormhole = new Wormhole({ urls: [ '/hello' ], httpServer }); wormhole.on('connect', ({ connectingSocket, accept, reject }) => { const socket = accept(); socket.send(Buffer.from(new Array(1000000))); socket.on('text', (e) => { console.log('Got text frame', e); }); socket.on('binary', (e) => { console.log('Got binary frame', e); }); }); httpServer.listen(8080);