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

Ping from server shutting down the connection #11

Open
A320Peter opened this issue May 23, 2022 · 0 comments
Open

Ping from server shutting down the connection #11

A320Peter opened this issue May 23, 2022 · 0 comments

Comments

@A320Peter
Copy link

I am new to WebSocket and Swift, and there is a high chance that I am wrong.

I communicate with a WebSocket server that randomly sends ping as an Opcode frame to the client and expects a pong. The connection is closed immediately because the incoming ping is incorrectly handled as an unknown message. After all, the incoming Opcode has context but no data and no error; therefore, it lands in the handleUknownMessage method followed by connection close.

The following temporarily solved my problem, but I doubt it's the correct way to do it. It might help somebody to do it the right way.

Screenshot 2022-05-23 at 21 03 16

Necessary update on the WebSocketMessage:

Screenshot 2022-05-23 at 21 04 15

Screenshot 2022-05-23 at 21 09 19

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

1 participant