I am using Faye in a rails application and I'm encountering a very
weird behavior where, if faye gets to subscribe
before all assets are served (that is,
after $(document).ready()
is called but while the spinner in your browser is running)
then faye will block the browser in "loading" mode (as in, the spinner never stops).
I believe I am using websockets and not long polling, although I'm not sure how to be certain. I do see in faye's log, when enabling debug messages referring to websocket:
2012-06-12 20:16:56 [DEBUG] [Faye::RackAdapter] Received via WebSocket[hybi-13]: [{"channel":"/meta/connect","clientId":"7w5vwypdaudnp9o64qwsb13om","connectionType":"websocket","id":"6s"}]
The browser connects to a standalone thin
server running
require 'faye'
require 'bundler/setup'
Bundler.require(:faye)
bayeux = Faye::RackAdapter.new(:mount => '/faye', :timeout => 25)
bayeux.listen(9292)
the command I'm using is
exec bundle exec rackup faye.ru -s thin -E production
I'm running faye 0.8
* faye (0.8.2)
* faye-websocket (0.4.5)
After 5 minutes I simply [Esc]
and those show up, that faye.js
is the script Faye serves, and it seems that each one of those files seems to correspond to each subscribe
call.
Interestingly enough, after those 5 files there are blocks of 5 calls, starting every one minute.
Any help with this would be much appreciated!
This is sort of a placeholder answer, in case someone else runs into something similar.
I've found that I was using a Faye.Client in two different places, thus two connections were being setup to the faye server, this is something that faye doesn't support (because it doesn't need to). Removing the other faye client helped, I'm still seeing strange behavior sometimes, but that has certainly improved things a little bit.