Created
November 21, 2022 16:59
-
-
Save yakovenkodenis/96fd67b305f545e6f59616c3a5061ce8 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('headers', ({ headers }) => console.log(headers)); | |
server.on('data', (message, reply) => { | |
if (!message) return; | |
const data = JSON.parse(message); | |
return reply({ pong: data }); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment