Open cyraid opened 4 years ago
There is no state change event. You might be confusing this with the previous version of SignalR (https://github.com/SignalR/SignalR)
Actually I was getting it from your docs. The docs state it's for the Javascript client, so I thought it'd be similar?
Are there any Typescript reference / docs / guides / examples? Am I using the wrong SignalR for typescript? In my package.json I have: @microsoft/signalr with version 3.1.0.
Actually I was getting it from your docs. The docs state it's for the Javascript client, so I thought it'd be similar?
Those are the docs for the previous version of SignalR. Note the banner at the top of the page:
Are you using ASP.NET Core? If so, the docs can be found here: https://docs.microsoft.com/en-us/aspnet/core/signalr/introduction?view=aspnetcore-3.1
Oh, apologies for not reading that. I did a search from Google and plopped on that page and must've scrolled to the events part. Is there a way to get events other than onreconnecting, onclose (specifically for the state field in the HubConnection)?
Is there a way to get events other than onreconnecting, onclose (specifically for the state field in the HubConnection)
What other events are you looking for? The only other lifecycle event I can think of here is when the connection is started, but you can know when that happens because the Promise returned by .start()
will be completed.
(Moving this to the Discussions milestone as this is more of a question on how to follow lifecycle events. If actionable work comes out the discussion we can file issues for that!)
Was kinda hoping for all states of:
/** The hub connection is disconnected. */
Disconnected = "Disconnected",
/** The hub connection is connecting. */
Connecting = "Connecting",
/** The hub connection is connected. */
Connected = "Connected",
/** The hub connection is disconnecting. */
Disconnecting = "Disconnecting",
/** The hub connection is reconnecting. */
Reconnecting = "Reconnecting"
It would also be nice if it were all in an event listener / subscriber type event state change like the 'stateChanged' instead of having to change the onreconnecting, onreconnect, onclose all separately.. Just a nit-pick I suppose. I've made my own subscriber interface using rxjs, and just set the events, and on each event trigger the state change event.
Was kinda hoping for all states of:
/** The hub connection is disconnected. */ Disconnected = "Disconnected", /** The hub connection is connecting. */ Connecting = "Connecting", /** The hub connection is connected. */ Connected = "Connected", /** The hub connection is disconnecting. */ Disconnecting = "Disconnecting", /** The hub connection is reconnecting. */ Reconnecting = "Reconnecting"
It would also be nice if it were all in an event listener / subscriber type event state change like the 'stateChanged' instead of having to change the onreconnecting, onreconnect, onclose all separately.. Just a nit-pick I suppose. I've made my own subscriber interface using rxjs, and just set the events, and on each event trigger the state change event.
Came here looking for the exact same thing. StompJS has a stateChanged RxJS Observable that is very nice to work with. Would love to see that added to the signalR library
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
None of the clients currently support state changed events.
Describe the bug
onreconnecting, onreconnected, onclose, and the event from start() are the only ones supported currently in the Typescript client, is this correct?
To Reproduce
Attempt to use stateChanged ..
Further technical details
SignalR for Typescript version 3.1.0.