Skip to content

Instantly share code, notes, and snippets.

@paulallies
Last active April 30, 2020 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulallies/e283f86836a638b302f0adc85983b9fa to your computer and use it in GitHub Desktop.
Save paulallies/e283f86836a638b302f0adc85983b9fa to your computer and use it in GitHub Desktop.
Web Socket Server
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