Last active
April 30, 2020 18:15
-
-
Save paulallies/e283f86836a638b302f0adc85983b9fa to your computer and use it in GitHub Desktop.
Web Socket Server
This file contains hidden or 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 WebSocket = require("ws"); | |
const wss = new WebSocket.Server({ port: 5556 }); | |
wss.on("connection", ws => { | |
ws.on("message", message => { | |
ws.send("Echo message sent back from server: " + message); | |
}); | |
ws.send("Hello! Message from server. You've just connected to the server!!"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment