Re: [jetty-users] Is it necessary to close session in WebSocketConnectionListener.onWebSocketError ?

2020-10-08 Thread Joakim Erdfelt
If you get an event on onClose() then you have transitioned from
CONNECTED/OPEN to CLOSING in the WebSocket state.

That merely indicates that the close handshake has begun.
It could have been locally initiated, it could have been remote initiated.
It doesn't really matter which side started it, both sides are now involved
in it.

onError will often (but not 100% of the time) result in a closed websocket.
Depending on when the onError occurs, you might not even have a onClose()
event.

For example, when you have a failure during the initial websocket handshake
during the attempt to OPEN the websocket state.
There's nothing to close if the error occurs then.

We try to call onClose for all cases where the state transitions from
CONNECTED/OPEN to CLOSING.

There is no event for when the websocket state transitions from CLOSING to
CLOSED.

Joakim Erdfelt / joa...@webtide.com


On Thu, Oct 8, 2020 at 10:18 AM Alexander Farber 
wrote:

> Good evening, the doc
>
>
> https://www.eclipse.org/jetty/javadoc/current/org/eclipse/jetty/websocket/api/WebSocketConnectionListener.html
>
> says, that when onWebSocketClose is called, then the session is closed
> automatically.
>
> But what about the other callback - the onWebSocketError?
>
> As a developer, do I have to call mSession.close() there myself? Or is it
> closed already?
>
> And another question please - is onWebSocketClose called, when I
> call mSession.close()?
>
> Best regards
> Alex
> ___
> jetty-users mailing list
> jetty-users@eclipse.org
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/jetty-users
>
___
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users


[jetty-users] Is it necessary to close session in WebSocketConnectionListener.onWebSocketError ?

2020-10-08 Thread Alexander Farber
Good evening, the doc

https://www.eclipse.org/jetty/javadoc/current/org/eclipse/jetty/websocket/api/WebSocketConnectionListener.html

says, that when onWebSocketClose is called, then the session is closed
automatically.

But what about the other callback - the onWebSocketError?

As a developer, do I have to call mSession.close() there myself? Or is it
closed already?

And another question please - is onWebSocketClose called, when I
call mSession.close()?

Best regards
Alex
___
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users