Method OnSessionEnded
OnSessionEnded()
Called when the session ends on this device: when a response clears the session cookie, when a request, streaming response or hub connection that
used the current session token fails with a 401 with the SignInRequired error code, when the service reports that the
session of a hub connection that used the current session token ended, and when ClearSessionToken() drops a token. On browser platforms,
where the browser holds the session cookie and the client doesn't know the session, it is called instead for every such 401 and report of a request
that began, or a hub connection that last connected, after a session last started (see NotifySessionStarted()): the reports of the
others concern the session that the new one replaced. There, a hub connection with ApiHubConnection.StayConnected whose session ended with
the SignInRequired error code reports it only once its attempt with the browser's session cookie is refused with it too,
since another tab may have signed in (see the SignalR client library). Does nothing by default.
Declaration
protected virtual void OnSessionEnded()
Remarks
It is called on the client that created the session: the client without a parent, whose child clients share its session. It runs after the session token changed callback, as part of the request or call that ended the session, even if the callback throws, and an exception that it throws propagates to that request or call.