Created
June 10, 2014 02:22
-
-
Save JFickel/6bbe0ba6c254424cc83c to your computer and use it in GitHub Desktop.
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
var WebSocketServer = require('ws').Server; | |
var http = require('http'); | |
var port = process.env.PORT || 5000; | |
var server = http.createServer(); | |
// this does nothing | |
server.on('request', function(req, res) { | |
console.log("HEADERS SHOULD BE HERE?") | |
console.log(req.headers); | |
}) | |
server.listen(port); | |
var wss = new WebSocketServer({server: server}); | |
console.log('http server listening on %d', port); | |
wss.on('connection', function(ws) { | |
// No user-agent here | |
console.log(ws.upgradeReq.headers) | |
ws.on('message', function(message) { | |
console.log('received: %s', message); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment