Skip to content

Commit

Permalink
Use faye for websocket request checks. No need to duplicate them.
Browse files Browse the repository at this point in the history
  • Loading branch information
brycekahle committed Oct 23, 2014
1 parent 2843d15 commit 1c4bed6
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/trans-websocket.coffee
Expand Up @@ -12,18 +12,10 @@ transport = require('./transport')

exports.app =
_websocket_check: (req, connection, head) ->
# Request via node.js magical 'upgrade' event.
if (req.headers.upgrade || '').toLowerCase() isnt 'websocket'
if not FayeWebsocket.isWebSocket(req)
throw {
status: 400
message: 'Can "Upgrade" only to "WebSocket".'
}
conn = (req.headers.connection || '').toLowerCase()

if (conn.split(/, */)).indexOf('upgrade') is -1
throw {
status: 400
message: '"Connection" must be "Upgrade".'
message: 'Not a valid websocket request'
}

sockjs_websocket: (req, connection, head) ->
Expand Down

0 comments on commit 1c4bed6

Please sign in to comment.