sta / sta/websocket-sharp

Connect times out on Android

Open
#114 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

websocket-sharp is working perfectly for me in the Unity editor and on iOS, but on Android, Connect() always times out before receiving a handshake. In the logs of my WebSockets server, I can see the Unity client connecting, and the handshake completes immediately from the server's point of view. On the Android side, however, my app hangs for awhile before finally reporting a timeout:

03-17 17:53:35.831  19580-19596/tv.rockscience.RockScience2 D/Unity﹕ 03/17/2015 17:53:35|FATAL|WebSocket.acceptException:0|WebSocketSharp.WebSocketException: A timeout has occurred while receiving a handshake.
            at WebSocketSharp.WsStream.ReadHandshake[HandshakeResponse] (System.Func`2 parser, Int32 millisecondsTimeout) [0x00000] in <filename unknown>:0
            at WebSocketSharp.WsStream.ReadHandshakeResponse () [0x00000] in <filename unknown>:0
            at WebSocketSharp.WebSocket.receiveHandshakeResponse () [0x00000] in <filename unknown>:0
            at WebSocketSharp.WebSocket.sendHandshakeRequest (WebSocketSharp.HandshakeRequest request) [0x00000] in <filename unknown>:0
            at WebSocketSharp.WebSocket.sendHandshakeRequest () [0x00000] in <filename unknown>:0
            at WebSocketSharp.WebSocket.doHandshake () [0x00000] in <filename unknown>:0
            at WebSocketSharp.WebSocket.connect () [0x00000] in <filename unknown>:0

I'm running Unity 4.6.3f1 Pro with both iOS and Android Pro, with a minimum Android API level of 4.0.3 and full .NET 2.0 compatibility level, using the websocket-sharp.dll from the Asset Store. I'm testing by exporting a development build as a Google Android Project and running it on my Android device with USB debugging from Android Studio.

Have you success reports from people using websocket-sharp on Android? I'm only using the client stuff, not the server.

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 by reproducing the timeout in the Android Unity build and compare the server handshake log with the client stack trace. Read WsStream.ReadHandshake, ReadHandshakeResponse, and WebSocket.receiveHandshakeResponse; done means the Android client receives and accepts the handshake instead of timing out.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.