sta / sta/websocket-sharp

Unity 5.1.3 Editor: An error has occurred while connecting.

Open
#159 2 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 Sta,

I just purchased this socket code from the store, but I am having trouble getting it to connect to my server.
My code is

    m_Socket = new WebSocket (m_Address);

    m_Socket.Log.Level = LogLevel.TRACE;
    m_Socket.Log.File = "websocket.log";

    m_Socket.OnMessage += HandleOnMessage;
    m_Socket.OnOpen += HandleOnOpen;
    m_Socket.OnClose += HandleOnClose;
    m_Socket.OnError += HandleOnError;
    m_Socket.Connect ();

However I am getting the following error in the log trace.

09/18/2015 16:52:18|DEBUG|WebSocket.send|A WebSocket connection request to ws://54.77.90.250:8080/data:
                      GET /data HTTP/1.1
                      User-Agent: websocket-sharp/1.0
                      Upgrade: websocket
                      Connection: Upgrade
                      Host: --------------------
                      Sec-WebSocket-Key: 9SZEhAZF5jZmvqimQfUDbQ==
                      Sec-WebSocket-Version: 13
09/18/2015 16:52:18|DEBUG|WebSocket.receiveHandshakeResponse|A response to this WebSocket connection request:
                      HTTP/1.1 403 Forbidden
09/18/2015 16:52:18|ERROR|WebSocket.doHandshake|Not WebSocket connection response.
09/18/2015 16:52:18|TRACE|WebSocket.close|Start closing handshake.
09/18/2015 16:52:18|DEBUG|WebSocket.closeHandshake|Was clean?: False
                      sent: False received: True
09/18/2015 16:52:18|TRACE|WebSocket.close|End closing handshake.
09/18/2015 16:52:20|WARN |WebSocket.send|Sending has been interrupted.

I can connect to my server with my chrome extension. So I'm not sure what the issue is.
Any help is greatly appreciated.

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 at the shown WebSocket.Connect() call and follow the doHandshake and receiveHandshakeResponse trace entries. Compare the websocket-sharp request with the successful Chrome extension connection, focusing on the server's HTTP 403 response. Done means identifying whether the endpoint or handshake is rejected and documenting a reproducible resolution.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.