Skip to content

Add support for wrapping an existing WS connection#180

Merged
EnriqueL8 merged 2 commits intomainfrom
ws-raw
May 8, 2025
Merged

Add support for wrapping an existing WS connection#180
EnriqueL8 merged 2 commits intomainfrom
ws-raw

Conversation

@peterbroadhurst
Copy link
Contributor

@peterbroadhurst peterbroadhurst commented May 5, 2025

The wsclient package is very helpful for wrapping a raw websocket connection, with heartbeating, and throttling.

I would like to use it for consistent handling like this of both outbound established connections, and inbound established connections (not using wsserver which is too opinionated for me).

This PR allows me to Wrap() an existing WebSocket per the demonstration unit test and treat it equivalently to a client connection.

Also fixed an issue where no backoff factor was being set on the retry.Retry for connect retry, meaning the library would fall back to 1 (so no backoff)

Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
…backoff)

Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
Copy link
Contributor

@EnriqueL8 EnriqueL8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@EnriqueL8 EnriqueL8 merged commit 8eb7508 into main May 8, 2025
3 checks passed
@EnriqueL8 EnriqueL8 deleted the ws-raw branch May 8, 2025 13:44
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

Successfully merging this pull request may close these issues.

3 participants