Skip to content

html client on page refresh or tab close websocket disconnect , is not fired on server side during message process #56

@ManoLazar

Description

@ManoLazar

...
while(webSocket.IsConnected && !cancellation.IsCancellationRequested) {
try {
var messageText = await webSocket.ReadStringAsync(cancellation).ConfigureAwait(false);
...
messageProcess(messageText) ;
await webSocket.WriteStringAsync(messageText, cancellation).ConfigureAwait(false);
...
so:
during the messageProcess () - can be with await
when html client reload page or TAB close, the webSocket is not fired as disconnect ??
and cause stuck on webSocket.WriteString...

if it is not during the messageProcess the server websocket listner fires correctly

why the code is written with while(webSocket.isConnected...) ?

and not just :

websocket.OnMessage(...)

webSocket.OnDisconnect(...)

webSocket.OnError(...)

so even on during messageProcess, if occur the disconnect event it will be fired ?

  1. can you send any code example how to resolve the messageProcess ?

any help ?

regards,
Mano

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions