tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

autobahn-server.js (436B)


      1 'use strict';
      2 
      3 const WebSocket = require('../');
      4 
      5 const port = process.argv.length > 2 ? parseInt(process.argv[2]) : 9001;
      6 const wss = new WebSocket.Server({ port }, () => {
      7  console.log(
      8    `Listening to port ${port}. Use extra argument to define the port`
      9  );
     10 });
     11 
     12 wss.on('connection', (ws) => {
     13  ws.on('message', (data, isBinary) => {
     14    ws.send(data, { binary: isBinary });
     15  });
     16  ws.on('error', (e) => console.error(e));
     17 });