(port)
| 17 | class SnapdropServer { |
| 18 | |
| 19 | constructor(port) { |
| 20 | const WebSocket = require('ws'); |
| 21 | this._wss = new WebSocket.Server({ port: port }); |
| 22 | this._wss.on('connection', (socket, request) => this._onConnection(new Peer(socket, request))); |
| 23 | this._wss.on('headers', (headers, response) => this._onHeaders(headers, response)); |
| 24 | |
| 25 | this._rooms = {}; |
| 26 | |
| 27 | console.log('Snapdrop is running on port', port); |
| 28 | } |
| 29 | |
| 30 | _onConnection(peer) { |
| 31 | this._joinRoom(peer); |
nothing calls this directly
no test coverage detected