Total Complexity | 2 |
Complexity/F | 1 |
Lines of Code | 17 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | const socketIo = require('socket.io'); |
||
2 | |||
3 | const sockets = require('./sockets/index'); |
||
4 | |||
5 | /** |
||
6 | * Init WebSocket server. |
||
7 | * |
||
8 | * @param {Object} httpServer HTTP server instance object. |
||
9 | */ |
||
10 | module.exports.listen = (httpServer) => { |
||
11 | const socketServer = socketIo.listen(httpServer); |
||
12 | |||
13 | socketServer.on('connect', (socket) => { |
||
14 | global.socket = socket; |
||
15 | global.socket.on('join', sockets.join); |
||
16 | }); |
||
17 | }; |
||
18 |