Fable.SignalR icon indicating copy to clipboard operation
Fable.SignalR copied to clipboard

Provide server streamFrom implementations are provided with the necessary CancellationToken

Open kentcb opened this issue 4 years ago • 0 comments

Pull request checklist

Please check if your PR fulfills the following requirements:

  • [ ] Tests for the changes have been added (for bug fixes / features)
  • [X] Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • [X] Build (fake build or .\build.cmd) on local branch was successful

Pull request type

Please check the type of change your PR introduces:

  • [X] Bugfix
  • [ ] Feature
  • [ ] Code style update (formatting, renaming)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] Documentation content changes
  • [ ] Other (please describe):

What is the current behavior?

Server to client stream implementations are not provided with a CancellationToken that signals clients disconnecting from the stream. Hence, long-lived streams will continue to stay alive indefinitely. The best the implementation can currently do is use FableHub<...>.HubContext.ConnectionAborted, but this will only trigger when the client disconnects. Long-lived clients will cause streams to remain open indefinitely.

What is the new behavior?

Server-to-client stream implementations are required to accept a CancellationToken parameter. This token is provided directly by SignalR and is triggered whenever clients cancel a stream (or if the client disconnects).

Does this introduce a breaking change?

  • [X] Yes
  • [ ] No

Other information

Sorry again for whitespace changes. There is a ton of dangling whitespace in this code base, so figured it makes sense to clean up as I go rather than disable the extension I have for this.

Fixes #34

kentcb avatar Sep 15 '21 03:09 kentcb