NetEase / UnitySocketIO

socket.io client for unity3d.
889 stars 229 forks source link

8 hours straight trying to make the simplest thing work #26

Open marteleto opened 10 years ago

marteleto commented 10 years ago

Hi,

I created a socket io server like this:

var io = require('socket.io').listen(5000);

io.sockets.on('connection', function (socket) { io.sockets.emit('evt', { foo: 'bar'}); });

and a pomelo client like this

using UnityEngine; using System; using System.Collections; using SimpleJson; using pomeloUnityClient;

public class TargetController : MonoBehaviour { private PomeloClient pclient = null;

void Start()
{
    string url = "http://localhost:5000";
    pclient = new PomeloClient(url);
    pclient.init();

    pclient.On("evt", (data)=>{
        Debug.Log("received something");
    });

    JsonObject emptyMessage = new JsonObject();
    emptyMessage.Add ("foo", "bar");

    pclient.notify("connection", emptyMessage);
}

}

and when I run the client part the server side logs this:

debug - client authorized info - handshake authorized BPbGYLLp1TfVeVOaKZAD

And on unity client part I get nothing, zero, no error, warnings, logs, nothing.

Can you help me find out what is missing?

Ty,

rainabba commented 9 years ago

I'm seeing the same with Node 10.26, Socket.IO 0.9.17, Express 3.20.1 and Unity 4.6.3f1 on Windows 8.1. Running the EXACT same server, Unity app (same Unity version) on OSX, my fellow developer can connect so it seems clear that it's something about the OS implementation.

DazzledApps commented 9 years ago

Can you please tell me how to create the server in C#