Handle error on websocket error

This commit is contained in:
Chocobozzz 2018-02-09 10:34:11 +01:00
parent c525c09375
commit bc4c766aca
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 1 additions and 0 deletions

View File

@ -116,6 +116,7 @@ const wss = new WebSocketServer({ server: server, path: '/tracker/socket' })
wss.on('connection', function (ws) {
trackerServer.onWebSocketConnection(ws)
})
wss.on('error', err => logger.error('Error in websocket server.', err))
const onHttpRequest = trackerServer.onHttpRequest.bind(trackerServer)
app.get('/tracker/announce', (req, res) => onHttpRequest(req, res, { action: 'announce' }))