Closed
Description
Allows the server to retain the send buffer while the client is reconnecting and preserve connection state (Context.Items
, connection ID, etc.).
Thoughts:
- Would need to be opt-in and supported by both client and server. Because client needs to change to try to reconnect with the same connection ID as its previous connection.
- Need an option to configure how long to keep the connection state on the server
- Skip negotiate doesn't play well in a multi-server environment when sticky-sessions aren't enabled
- How does it work with Azure SignalR Service
- Does the client need a new event to say "doing stateful reconnect"? What's the interaction with the current automatic reconnect feature?
- If client connects with different auth credentials, do we replace the
User
?
Needs work:
- Configurable buffer limit(s), total bytes count and maybe total message count too
- Versioning, probably increment HubProtocol and add "ack protocol"
-
Try to push feature fully into SignalR layer, i.e. get new ConnectionContext from lower layer and map onto existing connection- Replace IReconnectFeature with IExistingConnectionFeature or something, that contains the previous ID on the new ConnectionContext (because client will send old id via query string)
- Need timeout logic in SignalR layer then
- And pause the read loop waiting for a new connection
- Figure out what happens when a seamless reconnect takes too long, do we just kill the connection attempt, or keep it as a new connection (since the ConnectionContext is completely new) and send the new ID back to the client somehow?
- Potentially send a CloseMessage from clients to have a guaranteed way of knowing the connection close is graceful
- If not, finalize IReconnectFeature API
- Fix StopAsync race in WebSocketsTransport (Running task being overwritten), it might be delaying reconnect fallback logic
- Pool buffers in MessageBuffer
- Finalize options for enabling the feature, both client and server side
- And disallowing the feature from server side
- Retry policy for seamless reconnect attempts, separate from current reconnect policies
- Fix many TODOs in current code