Server rendering
How Angular behaves during server-side rendering and hydration.
Nothing connects on the server. Importing the package, calling createSignalRClient, and rendering a component start no connection.
What the server renders
Every hub reports the status "idle" during a server render.
The browser also reports "idle" on its first render. Because both sides match, hydration works and no mismatch warning appears.
The connection starts in the browser, after the first render. Then the status changes to "connecting" and "connected".
Calls during a server render
Angular disables the session on the server. An invoke or a wait rejects at once with SignalRDisabledError, and a teardown call resolves false. No timer stays pending.
Call injectHubInvoke in setup or component init, as with any helper. Do not call the function that it returns during a server render. Call that function in the browser, for example in an event handler. Use injectHubStatus to show an "offline" or loading state until the hub is connected.
Angular SSR
Angular opens no connection on the server. In the browser, provideSignalR starts the session in afterNextRender, and Angular does not run this callback on the server.
You can import the package and call provideSignalR during a server render. It registers the provider and builds the context, but opens no connection. On the server, the provider disables the session. Waits reject at once with SignalRDisabledError, the status stays "idle", and no timer stays pending.
Angular runs an effect on the server, so do not call the function that injectHubInvoke returns in a plain effect. Use afterNextRender, or an effect that runs only when the status is "connected".