Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Support CancellationToken on Hub methods? #2241

@martincostello

Description

@martincostello

I've just been playing around with the new SignalR RC1 bits, and copying a pattern from MVC I added an optional CancellationToken cancellationToken = default parameter to the end of my Hub class' method to pass through into a service to do something.

With the method declared as thus, trying to send a message from the JavaScript client did not hit the breakpoint I'd set in the hub. Removing this parameter and re-running the code hit the breakpoint.

So this leads me to ask a couple of questions:

  1. Is this a valid use-case in the first place compared to HTTP in MVC controllers?
  2. If this is a valid use-case, is this something coming in 2.1 for RTM (or some future release)?
  3. Is there something already accessible to Hub that can be used to pass to other code called by hub methods that's more useful than CancellationToken in lieu of the equivalent Controller scenario?

I've seen a view recently merged PRs related to cancellation tokens (e.g. #2101), but I wasn't sure whether that was just internally plumbing, rather than something to enable a scenario like this.

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