UnitySocketIO icon indicating copy to clipboard operation
UnitySocketIO copied to clipboard

Error initializing handshake with local url.

Open chilzyj opened this issue 8 years ago • 11 comments

When I tried create a new socket by doing same as how API done,It cames: Here is my code ,just same as api:https://github.com/NetEase/UnitySocketIO

void Start () {
    string url = "http://192.168.199.128:5500";
    client = new Client(url);
    client.Opened += SocketOpened;
    client.Message += SocketMessage;
    client.SocketConnectionClosed += SocketConnectionClosed;
    client.Error += SocketError;
    client.Connect();
}

private void SocketError(object sender, ErrorEventArgs e)
{
    Debug.Log(e.Message);
}

private void SocketConnectionClosed(object sender, EventArgs e)
{
    Debug.Log(e);
}

private void SocketMessage(object sender, MessageEventArgs e)
{
    Debug.Log(e.Message);
}

private void SocketOpened(object sender, EventArgs e)
{
    Debug.Log("Socket Connected!");
}

My Server is running at a VMWare machine. image And the Unity print: image

Could you help?Thanks!

chilzyj avatar Sep 12 '16 09:09 chilzyj

having the same problem. @chilzyj did you find a solution to this?

mhle avatar Oct 16 '16 15:10 mhle

I'm also having this problem. @chilzyj @mhle did either of you find a solution?

What's weird is I clearly see in my server console it connects, but it still errors.

Kampfkarren avatar Dec 24 '16 19:12 Kampfkarren

void Start () { string url = "http://192.168.199.128:5500"; client = new Client(url); ...... }

change to

string url = "http://192.168.199.128:5500"; client = new Client(url); void Start () {

...... }

52mary avatar Jun 15 '17 10:06 52mary

@chilzyj @mhle @boynedmaster hi guys, did you find a solution?

Wich version of pomelo are you using? Socket.io is very version dependent, and the problem could be there. I'm asking for any solution or client update in: https://github.com/NetEase/UnitySocketIO/issues/33

And there is a similar issue: https://github.com/NetEase/UnitySocketIO/issues/35

frabaglia avatar Jun 20 '17 23:06 frabaglia

@FrancooHM Sorry, I don't think I did. I just went with WebSocketSharp and ditched Socket.IO. It seems that the comment above you offers a solution, I haven't tried it.

Kampfkarren avatar Jun 21 '17 00:06 Kampfkarren

Thanks for your quick response @boynedmaster. You still using pomelo for WebSocketSharp? Wich version of both?

frabaglia avatar Jun 21 '17 00:06 frabaglia

I don't know what pomelo is, sorry.

Kampfkarren avatar Jun 21 '17 02:06 Kampfkarren

Oh, sorry i mixed up with another WebSockets lib of NetEase, and Pomelo is a GameServer of NetEase. What kind of solution did you implemented server side @boynedmaster ?

frabaglia avatar Jun 21 '17 03:06 frabaglia

I ended up just using a basic WebSocket server if I remember correctly @FrancooHM.

Kampfkarren avatar Jun 21 '17 18:06 Kampfkarren

@chilzyj 一样的问题,大佬可知道解决的办法

FirepadCN avatar Sep 18 '17 03:09 FirepadCN

you need to use socket.io v0.9 to connect to UnitySocketIO

strewhella avatar Sep 18 '17 22:09 strewhella