Azure / Azure/azure-c-shared-utility

uws_client: No indication that WebSocket has been closed, if close is initiated by server.

Open
#616 2 comments 0 reactions 1 assignee Claimed by @ewertons View on GitHub
question
Dominant language
C
Stars
116
Forks
216
Avg merge
2d 3h
Merged PRs (30d)
11

Description

This affects the `uws_client` WebSocket client. In cases where the server (rather than the client) initiates the closing handshake by sending a close frame, uws_client will respond to the server with a corresponding response frame and invoke the `on_ws_peer_closed` callback which was provided to `uws_client_open_async()`. When sending the close frame is completed, the underlying connection will eventually be closed. However at this point there is no callback indicating that the closing procedure has been completed to the user. As a consequence the user has no chance to know, for how much longer after receiving the `on_ws_peer_closed` callback it must continue to call `uws_client_dowork`. There's also no function that could be used to query the client's state.

There is a `on_ws_close_complete` callback that can be passed to `uws_client_close_async()`, but this function only comes into play if the closed handshake is initiated by the client, not in case it's initiated by the server.

Suggestion: Allow passing an `on_ws_closed` callback to `uws_client_open_async()` which would be called as soon as uws_client reaches a final state (i.e. the underlying connection is closed).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.