sta / sta/websocket-sharp

Closed Connection - Reason: An exception has occurred while connecting.

Open
#484 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.1k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

i am using websocket sharp in unity and in the server side i use SignalR, it's ok and everything works well but my problem is sometimes when i start to connect, the websocket sharp cause this error: "Closed Connection - An exception has occurred while connecting" and after that everytime i start application the error displaying again.
the websocket logger is:

8/21/2018 4:43:42 PM|Warn |Logger.set_File:0|The current path to the log file has been changed to websocket.log.
8/21/2018 4:43:42 PM|Debug|WebSocket.sendHttpRequest:0|A request to the server:
GET /signalr/connect?transport=webSockets&connectionToken=J4miXlCpKRgShrRbd8GK1au%2B6k7UYtBHV%2Fg2kRwG6iUh3yofmoKesO0Qm%2FwGnlfU700ieOENOeUEaGJOFYAQAFrS0lASreArieqM7XPOQmzeKIW4Dx2Rqc%2Fo05ZB9ztWcwWYErDRrlp30S0UNkDbxQ%3D%3D&connectionData=%5B%7B%22name%22%3A%22game%22%7D%5D&tid=8&authorization=Bearer%20eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiR3Vlc3RfMTAwNDkyIiwiaHR0cDovL3NjaGVtYXMubWljcm9zb2Z0LmNvbS93cy8yMDA4LzA2L2lkZW50aXR5L2NsYWltcy9zZXJpYWxudW1iZXIiOiJhYjY2YzkyNi1kMzhmLTQzYzAtOTIxYS1kNTFiNjZkZDEyZDAiLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjEwMDQ5MiIsIkFwcGxpY2F0aW9uVmVyc2lvbiI6IjEuMCIsIkRldmljZUlkIjoiYmI0MGU5NDU4YjY5ZTNjODU3ZTRhNzkzNTViNDFlNzEyZDg5NzdlMCIsIm5iZiI6MTUzNDg1MzY2MiwiZXhwIjoxNTM1MTEyODYyLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0LyIsImF1ZCI6IkFueSJ9.JYrsm48lwICMOMzY9MNwjgtBMGTPZcGbyrp-VwDBeJs HTTP/1.1
User-Agent: websocket-sharp/1.0
Host: artstorm.ir
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: c4g6LyAgEC9Z5loohIw5Vg==
Sec-WebSocket-Version: 13
8/21/2018 4:43:42 PM|Debug|WebSocket.sendHttpRequest:0|A response to this request:
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Server: Microsoft-IIS/10.0
X-Content-Type-Options: nosniff
Sec-WebSocket-Accept: DL56iuslEBzQrI8///p+uZVwm/Y=
Connection: Upgrade
X-Powered-By: ASP.NET
Date: Tue, 21 Aug 2018 12:14:22 GMT
8/21/2018 4:44:12 PM|Fatal|WebSocket.b__176_2:0|WebSocketSharp.WebSocketException: The header of a frame cannot be read from the stream.
at WebSocketSharp.WebSocketFrame.processHeader (System.Byte[] header) [0x00000] in :0
at WebSocketSharp.WebSocketFrame+<>c__DisplayClass73_0.b__0 (System.Byte[] bytes) [0x00000] in :0
at WebSocketSharp.Ext+<>c__DisplayClass50_0.b__0 (IAsyncResult ar) [0x00000] in :0
8/21/2018 4:44:12 PM|Debug|WebSocket.closeHandshake:0|Was clean?: False
sent: False
received: False

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported WebSocketFrame.processHeader, readHeaderAsync, and startReceiving stack-trace entries, then compare them with the logged HTTP 101 response and subsequent frame-read failure. Reproduce the Unity client connection against the SignalR server and determine the conditions that lead to the closed connection; document the cause and a reliable verification case.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.