Created
December 15, 2012 00:05
-
-
Save ozten/4289776 to your computer and use it in GitHub Desktop.
Connect to Socket.io from express code
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
| // At the top of routes.js | |
| var io = require('socket.io-client'); | |
| // Later | |
| socket = io.connect('http://localhost:9714', {headers: {'X-express-to-socket-password': 'some secret string'}}); | |
| //or | |
| socket = io.connect('http://localhost:9714', {'query': 'express-to-socket-password=some secret string'}); | |
| // In either case... all I see coming in at https://github.com/ozten/roomr/blob/master/server/sockets.js#L16 is | |
| /* | |
| authorization step | |
| { 'user-agent': 'node-XMLHttpRequest', | |
| accept: '* / *', | |
| host: 'localhost:9714', | |
| connection: 'keep-alive' } | |
| checking res.socket.encrypted | |
| ATTEMPTING TO authenticate new connection {} | |
| SESSION= {} | |
| User is allowed? false | |
| debug - authorized | |
| info - handshake unauthorized | |
| */ | |
| // What I want is | |
| /* | |
| authorization step | |
| { 'user-agent': 'node-XMLHttpRequest', | |
| accept: '* / *', | |
| host: 'localhost:9714', | |
| connection: 'keep-alive' | |
| headers: { | |
| "X-express-to-socket-password": 'some secret string" | |
| } | |
| } | |
| } | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment