public void SenderUsesDefaultChannelForMessage()
        {
            IMessageSender sender = Substitute.For <IMessageSender>();
            var            msg    = new NetworkPingMessage();

            sender.Send(msg);
            sender.Received(1).Send(msg, Channel.Reliable);
        }
        public void NotifySenderUsesDefaultChannelForSegement()
        {
            INotifySender sender = Substitute.For <INotifySender>();
            var           msg    = new NetworkPingMessage();
            object        token  = new object();

            sender.SendNotify(msg, token);
            sender.Received(1).SendNotify(msg, token, Channel.Unreliable);
        }
Beispiel #3
0
 internal void UpdateClient(NetworkClient client)
 {
     if (UnityEngine.Time.time - lastPingTime >= PingFrequency)
     {
         var pingMessage = new NetworkPingMessage
         {
             clientTime = LocalTime()
         };
         client.Connection.Send(pingMessage, Channel.Unreliable);
         lastPingTime = UnityEngine.Time.time;
     }
 }
Beispiel #4
0
 internal void UpdateClient(INetworkClient client)
 {
     if (UnityEngine.Time.time - _lastPingTime >= PingInterval)
     {
         var pingMessage = new NetworkPingMessage
         {
             clientTime = LocalTime()
         };
         client.Send(pingMessage, Channel.Unreliable);
         _lastPingTime = UnityEngine.Time.time;
     }
 }
Beispiel #5
0
        // executed at the server when we receive a ping message
        // reply with a pong containing the time from the client
        // and time from the server
        internal void OnServerPing(INetworkConnection conn, NetworkPingMessage msg)
        {
            if (logger.LogEnabled())
            {
                logger.Log("OnPingServerMessage  conn=" + conn);
            }

            var pongMsg = new NetworkPongMessage
            {
                clientTime = msg.clientTime,
                serverTime = LocalTime()
            };

            conn.Send(pongMsg, Channel.Unreliable);
        }