コード例 #1
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;
     }
 }
コード例 #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);
        }
    }
コード例 #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);
     }
 }
コード例 #4
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;
     }
 }