require('dotenv').config(); const express = require('express'); const { createServer } = require('node:http'); const { Server } = require('socket.io'); const app = express(); const server = createServer(app); const io = new Server(server); io.on('connection', (socket) => { console.log('A client connected!'); socket.on('nodeMessage', (msg) => { if (msg.password === process.env.NOTIFICATION_SERVER_PASSWORD) io.emit('message', msg.message); }) }); server.listen(process.env.NOTIFICATION_SERVER_PORT, () => { console.log(`server running on port ${process.env.NOTIFICATION_SERVER_PORT}`); });