diff --git a/ee/assist-server/server.js b/ee/assist-server/server.js index b6e5dc34a..891b74f22 100644 --- a/ee/assist-server/server.js +++ b/ee/assist-server/server.js @@ -33,7 +33,6 @@ const getCompressionConfig = function () { }; } -// Create a Socket.IO server with uWebSockets.js adapter const io = new Server({ maxHttpBufferSize: (parseFloat(process.env.maxHttpBufferSize) || 5) * 1e6, pingInterval: pingInterval, // Will use it for cache invalidation @@ -46,22 +45,19 @@ const io = new Server({ ...getCompressionConfig() }); -// Middleware for Socket.IO to check authorization io.use(async (socket, next) => await authorizer.check(socket, next)); -// Socket.IO connection handler io.on('connection', (socket) => onConnect(socket)); -// Attach Socket.IO to uWebSockets.js io.attachApp(app); io.engine.on("headers", (headers) => { headers["x-host-id"] = process.env.HOSTNAME || "unknown"; }); setSocketIOServer(io); -// Start the server +const HOST = process.env.LISTEN_HOST || '0.0.0.0'; const PORT = process.env.PORT || 3000; app.listen(PORT, (token) => { if (token) { - console.log(`Server running at http://localhost:${PORT}`); + console.log(`Server running at http://${HOST}:${PORT}`); } else { console.log(`Failed to listen on port ${PORT}`); }