-
Notifications
You must be signed in to change notification settings - Fork 85
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
Close behavior #88
Comments
This would be a better example to demonstrate the issue. In this example the exception is thrown 5 seconds after the connection is established to show that even after catching and handling the exception the connection can no longer be resumed nor properly closed. Maybe the thing is not to have the ability to "force-close" the connection but have the ability for React\EventLoop to recover from exception? Edit: wording |
@mbonneau I agree that the current situation is sub-optimal. We face the same problem in the underlying ReactPHP libraries, that's why we offer an In a higher-level protocol implementation like WebSocket, I think it makes sense to align with common implementations, such as those found in browsers. The usual WebSocket API only provides a single From a consumer perspective I don't think this is something a lot of consumers are actually going to implement properly, so perhaps an automatic soft-close timeout might be an option? I.e. first soft-close, then wait for a maximum of @caucik I'm not sure what you're suggesting, can you rephrase this to highlight how this is related to this ticket? |
This issue relates to PR #86.
Right now calling
close()
only callsend()
on the underlying socket. This can be problematic if the resource does not close in a timely manner as there is no timeout and there is no way to force the connection closed.The timeout solution would not solve the problem of closing the socket if the loop is stopped prior to flushing and closing.
Forcing the connection closed when
close()
is called could cause data loss or unclean closes on the server end.Would it make sense to change the
WebSocket
object to use similar semantics to the underlying connection by added anend()
that ends cleanly and aclose()
that just closes the connection?This would allow the user to manage the connection close by adding their own close timeout and giving them the ability to just close the underlying connection if desired.
The text was updated successfully, but these errors were encountered: