Network Disconnects - Abort or Close
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 30/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- csharp
- Ambito
- networking
Direzione di ricerca
Inizia tracciando websocket.Close() di NativeWebSocket fino alla chiamata a ClientWebSocket.CloseAsync() descritta nell'issue. Riproduci il comportamento in caso di disconnessione e perdita di pacchetti con Network Link Conditioner, quindi confronta le opzioni richieste Abort e CloseOutputAsync. Il lavoro è completato quando la scelta dell'API e il comportamento durante la perdita di connettività sono definiti e implementati, con una verifica per gli scenari segnalati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I came across few issues with disconnect and reconnect scenarios. I am using C# version of Websocket:
- calling
websocket.Close()hangs the client when we lose internet connection or when 100% packets drop due to poor connection (this scenario, client is connected to network, there is severe packet loss) websocket.Close()completes once network connectivity happens. But at that point, there is no reason to disconnect.- I did not check as to when timeout happens after
websocket.close()is called and network connectivity never happens. Client hangs for quite a long time on mac.
Note: I have used Network Link Conditioner on Mac to simulate network conditions apart from testing on Windows and Android. Each one of them behaves little differently. This is because OS level network settings.
ClientWebSocket has three methods CloseAsync, CloseOutputAsyncand Abort.
CloseAsyncandCloseOutputAsyncare for exchanging close frames between Server and Client. This for a more orderly shutdown when client wants to disconnect or server wants to terminate connection.Abortaborts connection and any pending I/O operations. This is asynccall and returns immediately.
Now coming back to NativeWebSocket, exposes websocket.Close() which calls CloseAsync() on ClientWebSocket. If network is disconnected, there is no point in calling CloseAsync or CloseOutputAsync as they are for terminating connections with acknowledgements. And there is no Abort method exists or a way to access ClientWebSocket as it is private.
For anyone who is curious as to how we detect network disconnects in our client - we use PingPong to send and receive msgs every n seconds/milliseconds. After sending a Ping, we don't receive a Pong within next n milliseconds - it is a disconnect.
I researched more about CloseAsync vs CloseOutputAsync and came across this article - https://mcguirev10.com/2019/08/17/how-to-close-websocket-correctly.html
Discussion points:
- Should there be a
Abortmethod onWebSocketin this library ? - Should
CloseOutputAsyncbe called instead ofCloseAsyncas client is initiating termination of websockets as per this article ?
- Lingua principale
- C#
- Stelle
- 1.7k
- Fork
- 206
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di endel/NativeWebSocket
-
Open UPM compatibility Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
endel/NativeWebSocket#107 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
endel/NativeWebSocket#102 · 1 commento · 1 reazione ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
endel/NativeWebSocket#101 · 6 commenti · 2 reazioni ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
endel/NativeWebSocket#95 · 1 reazione ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
endel/NativeWebSocket#94 · 2 commenti ·
Tutte le issue di endel/NativeWebSocket
Issue simili
-
[Feat] 조합 영역 구분선 개선 Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
type/automation type/tech-debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
t/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
ci-failure-cause test-failure
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100