firehoseio / firehose

Build realtime Ruby web applications. Created by the fine folks at Poll Everywhere.
http://firehose.io/
MIT License
727 stars 72 forks source link

Slow/old response messages from firehose server? #21

Closed jweissman closed 11 years ago

jweissman commented 11 years ago

I'm seeing some strange behavior with the Javascript client in particular. The network tab shows that some of the requests are taking around 10-15s or so to connect if it ever does (over ws://, with underscore and message parameters); where the request for the resource in question via curl (http://) completes immediately. I feel like I've got to be missing something.

For context -- I'm trying to use Firehose.io to hydrate some Backbone.js models. When a new model is created, it connects out to a firehose streaming resource; similarly for collections.

I'm expecting that it should get the latest copy of the resource immediately, as the curl client seems to. It's definitely not that all of the requests are like this, either -- but regularly I seem to be getting out-of-date resources.

(It just occurred to me the out-of-date issue may be orthogonal to the slow/no connection issue -- will keep poking locally... Really just wondering if any of this sounds symptomatic/familiar.)

jweissman commented 11 years ago

I'm thinking this is mostly problems with my local environment/implementation, and closing at this time. Basically I think I was overloading the pipe with messages and maybe clients getting out of sync. I've also noticed that there seem to maybe be problems when there are two instances of a JS subscriber even in a different browser (though this is a little less clear/obvious to me what might be going on.)

steel commented 11 years ago

How are you determining the 10-15s to connect? In the Chrome inspector you should see an initial request to the JSON resource. Then it will try to upgrade the connection to Web Sockets. Once the WS connection is established, the JSON long poll connection is terminated. It'll look something like this:

What s your favorite color 2013-04-18 21-17-26

jweissman commented 11 years ago

Thanks for clarifying -- maybe this accounts for what I was seeing? I was seeing the times indicated above in the network inspector tab, but maybe I was misinterpreting what was there. I will plan to take some screenshots once I'm able to dig into this a bit further on my end.