Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection still marked as open after server shutdown #32

Open
cesme opened this issue Sep 8, 2017 · 4 comments
Open

Connection still marked as open after server shutdown #32

cesme opened this issue Sep 8, 2017 · 4 comments

Comments

@cesme
Copy link

cesme commented Sep 8, 2017

Hello,

I am using the nuget package 1.1.9 assembly versions droid 1.0.1.8 and PCL 1.0.0.8 and i am noticing that if i shutdown my server the clients will still report that IsOpen is true. Looking through the code in master i wasn't able to locate any timeouts in the Send functions that would mark the connection as closed or trigger an OnError am i missing something in the code ? Is there a proper way to set a send timeout to get the OnError to trigger to detect the server going away ?

thank you

@kolbma
Copy link
Contributor

kolbma commented Oct 1, 2017

  1. That's a bug in your server. Your server needs to close the connections before it's going away. This should be handled in OnClose...
  2. If your client should handle server crashes WebSocket provides Ping and Pong.

Your client needs to send Pings to the server and the server must (by standard) respond with a Pong. If there is no Pong coming, the server is not available any longer and the client can throw away connection.

I think Websockets.PCL doesn't support this at the moment.
But I think you'll get an OnError on trying to send something. There should be a default time of the sockets. Shouldn't it? Try to wait some more time for this timeout.
Can you provide this feedback?

@canton7
Copy link

canton7 commented Oct 24, 2017

I'm seeing the OnClosed event being fired, but IsOpen still returns true (on Android).

@LeonanFragaLeonardo
Copy link

LeonanFragaLeonardo commented Feb 20, 2018

Hello,
Almost a year later and the problem still happens.
I have the same problem when I try to close my client-side connection.
I call OnClose, the server side closes the connection, but the IsOpen flag is still true.
Did someone solve this problem?

--Edit--
For a temporary workaround, I created a new variable called IsOpenedSocket in my project.
When the OnClosed or OnError method is called, this flag is set to false and when the OnOpened method is called, this flag is set to true. Did work for me.

@MagnusEklof
Copy link

MagnusEklof commented Feb 24, 2020

And yet another year... I guess I too will need to keep track of this myself.. even 2 years ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants