implementation #108

bellingboe opened this Issue Mar 23, 2012 · 8 comments

4 participants


I've tried using just like you would with Express, except having it listen on geddy.server

var io = require('').listen(geddy.server);

That works, as going to / brings up the "Welcome to" page, but the problem occurs when clients' browsers try to load / via <script src...></script> It's just simply not found.

I'm assuming it's a routing issue as @mde had mentioned socket routing :)


I'm looking into this one, I'll keep you updated with info as I learn more.


I got Now.js up and running with geddy.

var httpServer = require('http').createServer().listen(8080)
    , nowjs = require('now')
    , everyone = nowjs.initialize(httpServer);

You can't use geddy.server. Just need to create another one on a different port.


Odd, this should work with the geddy.server; We'll have docs for this soon.


Are there any updates with this issue?

I can use on a separate port by doing

geddy.sockets = require('').listen(4002)

But I would really prefer having it on the same port as the server of course.


Sorry @Hunter-Dolan I haven't had a chance to get to this one yet. I'll see about taking a look at it soon.

What happens when you try to serve using geddy.server?


No problem. When I try to use geddy.server it is able to serve the "Welcome to" when you access /

Afterwards the server worker process will crash.

This is what it shows in the log

[Wed, 27 Jun 2012 22:06:42 GMT] INFO Server worker running in development on port 4000 with a PID of: 2034
   info  - unhandled url

    throw new Error("Can't set headers after they are sent.");
Error: Can't set headers after they are sent.
    at ServerResponse.setHeader (http.js:536:11)
    at [object Object].setHeaders (/usr/local/lib/node_modules/geddy/lib/response.js:117:17)
    at [object Object].send (/usr/local/lib/node_modules/geddy/lib/response.js:66:10)
    at Server.<anonymous> (/usr/local/lib/node_modules/geddy/lib/app.js:551:19)
    at Server.emit (events.js:88:20)
    at HTTPParser.onIncoming (http.js:1610:12)
    at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:91:29)
    at Socket.ondata (http.js:1506:22)
    at TCP.onread (net.js:374:27)
[Wed, 27 Jun 2012 22:06:46 GMT] ERROR Worker 2034 died.

I would assume that is sending the http headers and content then Geddy is trying to pick it up and route it like a regular page, which of course is causing it to throw an error because the connection is probably already closed.


Thanks for the feedback.

@mde Do you think you could help out with this one? You know the routing/http code better than anyone else I think.

@Hunter-Dolan Hunter-Dolan added a commit to Hunter-Dolan/geddy that referenced this issue Jun 27, 2012
@Hunter-Dolan Hunter-Dolan Added try/catch statement to fix issues with and Geddy. (Fi…
…xes issue #108)

Alright guys, this is fixed in master right now. I'll let @mde take a look through it and then publish it to npm.

The usage looks like this:

  1. add socketIo: true to your config file
  2. install npm install
  3. create a config/after_start.js file in your app
  4. put your code in there: use, you don't need to require anything.

You can check out a full example in the examples directory:

This is just the start of the planned integration. We're open to ideas on how to make this better, and how to make Geddy and work better together.

@Techwraith Techwraith closed this Jul 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment