Doua Beri
Doua Beri

Reputation: 10939

jetty 9, websockets and closing websocket connection on server side

I have an application that uses a websocket server based on jetty 8. Everything is working great, and when the user refreshes the page, closes the page or move to another page the connection is closed and, on the server side the onClose event is triggered.

I just moved to jetty 9 and in firefox everything works the same ( on refresh the connection is closed) but not on chrome or opera. I even close the browsers and the onClose event didn't triggered.

I know jetty 9 only supports the latest websockets protocol version, and I wanna know if the browser is sending some message to the server when the user refreshed the page for example, and how to handle this on jetty or do I have to handle this in javascript like in this example : Closing WebSocket correctly (HTML5, Javascript) using window.onbeforeunload ?

I would preffer if I can handle all the work on the server side. Thanks

UPDATE If I close the connection from the client using ws.close() everything works great.

Upvotes: 4

Views: 2609

Answers (1)

Joakim Erdfelt
Joakim Erdfelt

Reputation: 49452

There were a few close and disconnect detection bugs in Jetty 9.0.0

  • 406449 - Session's disconnect not detected
  • 404991 - WebSocketCloseTest fails spuriously

Both of those were recently fixed and delivered in Jetty 9.0.3.v20130506 please give that version a try.

Upvotes: 2

Related Questions