예제 #1
0
 /// <summary>
 /// When a client connects create a new PeerConnection and send the information the the client
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="onClientConnectArgs"></param>
 private void _OnOpen(object sender, OnClientConnectArgs onClientConnectArgs)
 {
     Peer = new PeerConnection
     {
         Context = Guid.NewGuid(),
         PeerId = ConnectionId
     };            
 }
 private IEnumerable<ConnectionBroker> GetConnections(IPeerConnection peerConnection)
 {
     return this.Find(f => f.Peer.Context == peerConnection.Context).Select(p => p).Except(new List<ConnectionBroker> { this });
 }
예제 #3
0
 /// <summary>
 /// When a client connects create a new PeerConnection and send the information the the client
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="onClientConnectArgs"></param>
 private void _OnOpen(object sender, OnClientConnectArgs onClientConnectArgs)
 {
     Peer = new PeerConnection
     {
         Context = this.ProtocolInstance.Parameters.ContainsKey("ctx") ? Guid.Parse(this.ProtocolInstance.Parameters["ctx"]) : Guid.NewGuid(),
         PeerId = ClientGuid
     };
 }
        /// <summary>
        /// When a client connects create a new PeerConnection and send the information the the client
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="onClientConnectArgs"></param>
        private void _OnOpen(object sender, OnClientConnectArgs onClientConnectArgs)
        {
            // Get the context from a parameter if it exists
            var context = Guid.NewGuid();

            if (this.HasParameterKey("ctx"))
            {
                var p = this.GetParameter("ctx");
                context = Guid.Parse(p);
            }

            Peer = new PeerConnection
            {
                Context = context,
                PeerId = ConnectionId
            };

            this.Invoke(Peer, Events.Context.Created);
        }