@srsl/tools
Version:
JavaScript tools for common interfaces
20 lines (16 loc) • 432 B
JavaScript
const http = require('http')
const SocketIO = require('socket.io')
module.exports = async (options = {}) => {
const server = http.createServer()
const io = SocketIO(server, {
path: '/',
serveClient: false,
// below are engine.IO options
pingInterval: 10000,
pingTimeout: 5000,
cookie: false,
...options,
})
server.listen(process.env.SOCKET_IO_PORT || 3133)
return { io, server, SocketIO }
}