private void OnSentToClient(bool success, ISocketClientToken client) { if (success) { Debug.Log(string.Format("<color=red>Sent to client({0})</color>", client.ID)); } }
private void OnClientConnected(ISocketClientToken client) { Debug.Log(string.Format("<color=red>Client({0}) connected. Connected clients: {1}</color>", client.ID, _server.Clients.Count)); client.Send(Encoding.UTF8.GetBytes("welcome")); /*try * { * GameObject.CreatePrimitive(PrimitiveType.Cube); //should be called from main thread * } * catch (Exception ex) * { * Debug.LogException(ex); * }*/ }
private void OnClientDisconnected(ISocketClientToken client) { Debug.Log(string.Format("<color=red>Client({0}) disconnected. Connected clients: {1}</color>", client.ID, _server.Clients.Count)); }
private void OnReceivedFromClient(ISocketClientToken client, byte[] message) { Debug.Log(string.Format("<color=red>Received from client({0}): {1}</color>", client.ID, Encoding.UTF8.GetString(message))); }