Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Should session.close() be called in onWebSocketClose and onWebSocketError?

Hi,

On Thu, Jun 9, 2016 at 6:18 PM, Alexander Farber
<alexander.farber@xxxxxxxxx> wrote:
> Dear Jetty users,
>
> I have questions related to WebSocketListener implementation like the one
> here:
>
> https://www.eclipse.org/jetty/documentation/current/jetty-websocket-api-listener.html
>
> Should I call session.close() method in the callbacks onWebSocketClose and
> onWebSocketError in order to "properly" close the connection?

No, the implementation takes care of that.

> Also, when onWebSocketError was called, does it mean the websocket
> connection is closed? Or does it mean a temporary failure and should I retry
> calling session.getRemote().sendString(message,null) again?

Assume that the connection is broken/closed.

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.


Back to the top