Last active
November 21, 2022 16:59
-
-
Save yakovenkodenis/5adda311308e0cb7df012fc8c0bea4e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const PORT = 4000. | |
const server = new WebSocketServer({ port: PORT }); | |
server.on('data', (message) => { | |
if (!message) return; | |
const data = JSON.parse(message); | |
console.log('Message received:', data); | |
}); | |
server.listen(() => { | |
console.log(`WebSocket server listening on port ${PORT}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment