Ejemplo n.º 1
0
 public void Broadcast(ISdpPacket packet)
 {
     byte[] data = SdpCodec.Encode(packet);
     if (data.Length == 0)
     {
         return;
     }
     Service.Sessions.BroadcastAsync(data, null);
 }
Ejemplo n.º 2
0
 public void SendTo(string id, ISdpPacket packet)
 {
     byte[] data = SdpCodec.Encode(packet);
     if (data.Length == 0)
     {
         return;
     }
     Service.Sessions.SendToAsync(data, id, null);
 }
Ejemplo n.º 3
0
        public void Send(ISdpPacket packet)
        {
            if (!(Client.IsAlive && Client.ReadyState == WebSocketState.Open))
            {
                return;
            }

            byte[] data = SdpCodec.Encode(packet);
            if (data.Length == 0)
            {
                return;
            }
            Client.SendAsync(data, null);
        }
Ejemplo n.º 4
0
        protected override void OnMessage(MessageEventArgs e)
        {
            if (!e.IsBinary)
            {
                return; // Invalid data format. Skipping message.
            }
            var packet = SdpCodec.Decode(e.RawData);

            if (packet == null)
            {
                // failed to decode packet
                return;
            }

            Manager.IncomingPackets.Enqueue(new Tuple <string, ISdpPacket>(ID, packet));
        }
Ejemplo n.º 5
0
        private void Client_OnMessage(object sender, MessageEventArgs e)
        {
            if (!e.IsBinary)
            {
                return; // Invalid data format. Skipping message.
            }
            var packet = SdpCodec.Decode(e.RawData);

            if (packet == null)
            {
                // failed to decode packets
                return;
            }

            Manager.IncomingPackets.Enqueue(new Tuple <string, ISdpPacket>(string.Empty, packet));
        }