Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

engine.io integration #575

Closed
yocontra opened this issue Apr 4, 2014 · 4 comments
Closed

engine.io integration #575

yocontra opened this issue Apr 4, 2014 · 4 comments

Comments

@yocontra
Copy link

yocontra commented Apr 4, 2014

I'm trying to use engine.io with restify and can't seem to get it to work. It seems like restify is messing with the requests that come in even though I have no handlers set up for them.

Uncaught Error: Can't set headers after they are sent.
      at ServerResponse.OutgoingMessage.setHeader (http.js:691:11)
      at ServerResponse.format (/Users/contra/Projects/wildfire/node_modules/restify/lib/response.js:98:10)
      at ServerResponse.send (/Users/contra/Projects/wildfire/node_modules/restify/lib/response.js:208:24)
      at emitRouteError (/Users/contra/Projects/wildfire/node_modules/restify/lib/server.js:150:13)
      at onRoute (/Users/contra/Projects/wildfire/node_modules/restify/lib/server.js:617:17)
      at Router.find (/Users/contra/Projects/wildfire/node_modules/restify/lib/router.js:479:5)
      at Server._route (/Users/contra/Projects/wildfire/node_modules/restify/lib/server.js:611:17)
      at routeAndRun (/Users/contra/Projects/wildfire/node_modules/restify/lib/server.js:570:14)
      at Server._handle (/Users/contra/Projects/wildfire/node_modules/restify/lib/server.js:590:9)
      at Server.onRequest (/Users/contra/Projects/wildfire/node_modules/restify/lib/server.js:254:14)
      at Server.EventEmitter.emit (events.js:98:17)
      at HTTPParser.parser.onIncoming (http.js:2108:12)
      at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:121:23)
      at Socket.socket.ondata (http.js:1966:22)
      at TCP.onread (net.js:527:27)

I see there is a special case for socket.io to make restify leave requests for it alone. https://github.com/mcavage/node-restify/blob/master/lib/server.js#L250

@yocontra yocontra changed the title Special case for handling socket.io? engine.io integration Apr 4, 2014
@yocontra
Copy link
Author

yocontra commented Apr 4, 2014

Yup it looks like if I manually go add a regex the problem is solved. There should be an option to ignore certain regex patterns instead of manually hardcoding them into the library IMO

@yocontra
Copy link
Author

yocontra commented Apr 4, 2014

Temporary fix (for anyone else who has the same problem): Bind to server.server which bypasses restify completely

@micahr
Copy link
Member

micahr commented Jun 17, 2015

Looks like we need to do a better job of allowing web socket based routes, and not require hard coding of urls in order to get around the pre processing of request attributes. Will add this to the backlog.

@retrohacker
Copy link
Member

This appears to have been resolved in #669

If I'm missing a nuance here, please call me out on it! We can re-open this issue and discuss!

retrohacker pushed a commit that referenced this issue Apr 29, 2017
Closes:

#289
#381
#474
#575
#790
#633
#717
#576
#576
#909
#875
#860
#853
#850
#829
#813
#801
#921
#1101
#1019
#989
#632
#708
#737
#859
#1326
#1327
#927
#1099
#1068
#1040
#1035
#957
#948
#1134
#1136
#1183
#1206
#1286
#1323

> Note: this issue closes _but does not resolve_ the issues listed, we are just tracking them in another medium
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants