void Start() { // Change an option to show how it should be done SocketOptions options = new SocketOptions(); options.AutoConnect = false; // Create the SocketManager instance var manager = new SocketManager(new Uri("http://io.weplay.io/socket.io/"), options); // Keep a reference to the root namespace Socket = manager.Socket; // Set up our event handlers. Socket.On(SocketIOEventTypes.Connect, OnConnected); Socket.On("joined", OnJoined); Socket.On("connections", OnConnections); Socket.On("join", OnJoin); Socket.On("move", OnMove); Socket.On("message", OnMessage); Socket.On("reload", OnReload); // Don't waste cpu cycles on decoding the payload, we are expecting only binary data with this event, // and we can access it through the packet's Attachments property. Socket.On("frame", OnFrame, /*autoDecodePayload:*/ false); // Add error handler, so we can display it Socket.On(SocketIOEventTypes.Error, OnError); // We set SocketOptions' AutoConnect to false, so we have to call it manually. manager.Open(); // We are connecting to the server. State = States.Connecting; }