Last active
August 29, 2015 14:15
-
-
Save gtomitsuka/d0ef58227ee10a892d40 to your computer and use it in GitHub Desktop.
WebSockets + Express.js Server
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
/* 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