Create new websocket function websocket_check_pingpong #1744
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a new method called
websocket_check_pingpong
#1717Right now, It's merely a wrapper around
uwsgi_websocket_recv_do
(likewebsocket_recv
andwebsocket_recv_nb
) and the non-blocking behaviour is hardcoded.I tried to call the C function
uwsgi_websockets_check_pingpong
but I got errors and since the internals ofuWSGI
isn't documented, I didn't really know what to do. I believe some things must be done on thewsgi_request
(e.guwsgi_websocket_parse_header(wsgi_req);
) before trying to send a ping or receive a pong.The only solution was to copy most of the code from
uwsgi_websocket_recv_do
but that doesn't seem right.I'm submitting this PR (Not to be merged in its current state) because I don't really know how to proceed and how to handle non-blocking and blocking mode that's an argument to
uwsgi_websocket_recv_do
(It's only used in one place in the function body so I feel it can easily be removed) .Obviously there are no tests yet 😄