Skip to content

Instantly share code, notes, and snippets.

@gtomitsuka
Last active August 29, 2015 14:15
Show Gist options
  • Save gtomitsuka/d0ef58227ee10a892d40 to your computer and use it in GitHub Desktop.
Save gtomitsuka/d0ef58227ee10a892d40 to your computer and use it in GitHub Desktop.
WebSockets + Express.js Server
/* ws.js
* Simple WebSockets + Express.js code
*/
//APIs
var express = require("express"); //Express.js - Serve pages
var app = express();
var http = require("http").Server(app); //HTTP - Server listen
var ws = require("ws");
//Globals
var wss = new WebSocketServer({server: server, path: "/mt-ws");
http.listen(8080, function(){
console.log('listening on port 8080');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment