-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Description
Test from here: https://github.com/dotnet/runtime/pull/99413/files#diff-833e4f96268680f6e3161446593f03844000ff0dafd163add5b0f856d2e2360f
If we do:
connect wb, server sends a message and closes
scenario 1): Client waits some time, calls ReceiveAsync -> client receives the buffered message, no exception because managed code did not update the ws's state.
scenario 2): Client waits some time, checks the server's state by accessing WebSocket.State, calls ReceiveAsync -> exception, Unhandled exception rendering component: The WebSocket is in an invalid state ('Closed') for this operation. Valid states are: 'Open, CloseSent' because by accessing State property we made the closing state propagate to C#.
Internally we don't use State but FastState. Only getting State triggers JS interop.