Skip to content

Conversation

@Ruhrpottpatriot
Copy link
Contributor

This PR improves on cancellation and fixes some critical bugs involving the async code, see commit messages for more details.

With cancellation logic in the constructor a reuse of the socket is not
possible. By moving it into the ConnectAsync() method the client can
connect and disconnect without always creating a new instance of the
WebSocketTextClient class.
Task.Start() should never be called in the first place.
It introduces problems and should be avioded.
See: https://stackoverflow.com/a/29693430/1922663
The internal token source was never initialized,
this has been fixed.
- Receive task is now started as fire and forget in the constructor
- Receive task now only handles messages, when the socket has an open
  connection
- Exposed uncerlying socke object as a public read only property
- Exposed a public "Connected" read only property
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.

1 participant