/// <summary>
 /// Send a raw SocketIOMessage to the server.
 /// </summary>
 /// <param name='msg'>
 /// Message.
 /// </param>
 public int Send(SocketIOMessage msg)
 {
     msg.id = msgUid++;
     if(socket == null) {
         Debug.LogError("Socket.IO is not initialised yet!");
         return -1;
     } else {
         socket.Send (msg.ToString ());
         return msg.id.Value;
     }
 }
Ejemplo n.º 2
0
    IEnumerator Heartbeat()
    {
        var beat = new SocketIOMessage();

        beat.type = SocketIOMessage.FrameType.HEARTBEAT;
        var delay = new WaitForSeconds(heartbeatTimeout * 0.8f);

        while (socket.connected)
        {
            socket.Send(beat.ToString());
            yield return(delay);
        }
    }
Ejemplo n.º 3
0
 /// <summary>
 /// Send a raw SocketIOMessage to the server.
 /// </summary>
 /// <param name='msg'>
 /// Message.
 /// </param>
 public int Send(SocketIOMessage msg)
 {
     msg.id = msgUid++;
     if (socket == null)
     {
         Debug.LogError("Socket.IO is not initialised yet!");
         return(-1);
     }
     else
     {
         socket.Send(msg.ToString());
         return(msg.id.Value);
     }
 }
 IEnumerator Heartbeat()
 {
     var beat = new SocketIOMessage ();
     beat.type = SocketIOMessage.FrameType.HEARTBEAT;
     var delay = new WaitForSeconds (heartbeatTimeout * 0.8f);
     while (socket.connected) {
         socket.Send (beat.ToString ());
         yield return delay;
     }
 }