0

this is bugging me for almost two days.

I'm writing Bayeux client. I use WebSocket-client library from Jetty and connecting to Faye server.

I open a WS connection to the server (everything localhost) with handshake request:

{"channel":"/meta/handshake","supportedConnectionTypes":["long-polling","callback-polling","websocket"],"version":"1.0"}

The client immediately receives a handshake response:

{"channel":"/meta/handshake","successful":true,"version":"1.0","supportedConnectionTypes":["long-polling","cross-origin-long-polling","callback-polling","websocket","eventsource","in-process"],"clientId":"l8xhgf0t5gikcukcknhr5npfx11s5w9","advice":{"reconnect":"retry","interval":0,"timeout":45000}}

Then client sends connect request:

{"clientId":"l8xhgf0t5gikcukcknhr5npfx11s5w9","connectionType":"websocket","channel":"/meta/connect"}

Then the server hangs for 45s (the value of time out) and then sends this response:

{"clientId":"l8xhgf0t5gikcukcknhr5npfx11s5w9","channel":"/meta/connect","successful":true,"advice":{"reconnect":"retry","interval":0,"timeout":45000}}

last log message on Faye server before it hangs: Ping "l8xhgf0t5gikcukcknhr5npfx11s5w9", 45

But I never receive Ping frame on client side. I have no idea why the server hangs for those 45s, but I need to resolve this. Have anyone of you seen this before? Any help/suggestions/hints much appreciated :)

Tomas Zaoral
  • 499
  • 2
  • 5
  • 11

1 Answers1

1

The behaviour you are experiencing is exactly what a Bayeux server should do.

The server does not "hang"; it holds the request in a long-polling fashion.

I don't know much Faye but the CometD project, which defined the Bayeux protocol specification, implements a server in the same way, where the /meta/connect message request is held for the timeout value.

sbordet
  • 16,856
  • 1
  • 50
  • 45
  • Thank you very much! I was confused because I selected the transport to be websocket, therefore I expected the message to be returned immediately. Next time I need to read the specs more carefully. – Tomas Zaoral Feb 25 '15 at 13:33
  • @TomasZaoral as the CometD project leader I will be interested in what language / platform you are writing the Bayeux client. The CometD project has a Java and a JavaScript one not sure about the Faye project. – sbordet Feb 25 '15 at 17:31