Skip to content

Ping from server shutting down the connection #11

@aviationio

Description

@aviationio

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions