Skip to content

Concurrency version of connect can potentially miss messages that the other client sends on connect. #156

@Cyberbeni

Description

@Cyberbeni

Describe the issue

See title

Vapor version

Not using Vapor, WebSocket-kit 2.15.0

Operating system and version

alpine:latest docker container

Swift version

6.0.2 docker image with static Linux SDK

Steps to reproduce

Connect to a Home Assistant server inside an actor. (Tested with HA version 2025.1.4, running on the same machine)
When there is a new Task started inside onUpgrade (either by the wrapper in WebSocket-kit or using the connect function with futures and doing it manually) and the onText callback of the webSocket is set up inside that, the initial auth_required message from the Home Assistant server is most often not delivered.
If I use the connect function with futures and set the onText callback then I seem to receive that message every time. (Then I need to start a new task, so I can save the WebSocket to a variable, so I can use it for sending messages)

Outcome

No response

Additional notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions