sta / sta/websocket-sharp

Unity 4.3 can't connect to websocket

Open
#44 13 comments 0 reactions 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

Hi!

I have a C# Console application that serves as my server.
My unity game serves as the client ( and has your plugin embedded ).

However it seems like I never can connect to my server.

I tried your code you posted @ Issue #35 and I get the following output:

Open Socket: CONNECTING
Websocket Alive: False
WebSocket-> Error: An exception has occured while connecting.
Open socket-> OnError: CONNECTING
WebSocket-> Close-code: 1006
Websocket-> Close-reason: An exception has occured while connecting
Open Socket -> OnClose: CLOSED
WebSocket-> Error: The WebSocket connection has already been closed.
Open Socket -> OnError: CLOSED
WebSocket-> Error: The WebSocket connection has already been closed.
. . .
Open Socket -> OnError: CLOSED
WebSocket-> Error: The WebSocket connection has already been closed.
. . .

Any idea what the problem is?
Note that when i make another C# console application as a client, and have similar code in it, that it does work. So it only doesn't work when using it from within unity...

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 connection using the Unity client and the C# Console server, then compare it with the working C# Console client. Review the connection code from Issue #35 and the Open Socket, OnError, and OnClose callbacks. Done means Unity 4.3 establishes the websocket connection without the repeated closed-state errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
game-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.