Exemplo n.º 1
0
 public IList <HttpRequest> GetWebSockets()
 {
     if (mVersion != BaseServer.Version)
     {
         if (System.Threading.Interlocked.CompareExchange(ref mGetWebsocketStatus, 1, 0) == 0)
         {
             try
             {
                 if (mVersion != BaseServer.Version)
                 {
                     ISession[]         items = BaseServer.GetOnlines();
                     List <HttpRequest> lst   = new List <HttpRequest>();
                     for (int i = 0; i < items.Length; i++)
                     {
                         HttpToken token = (HttpToken)items[i].Tag;
                         if (token != null && token.WebSocket)
                         {
                             lst.Add(token.Request);
                         }
                     }
                     mOnlines = lst;
                     mVersion = BaseServer.Version;
                 }
             }
             finally
             {
                 System.Threading.Interlocked.Exchange(ref mGetWebsocketStatus, 0);
             }
         }
     }
     return(mOnlines);
 }
Exemplo n.º 2
0
 public void SendDataFrame(DataFrame data)
 {
     foreach (ISession item in BaseServer.GetOnlines())
     {
         SendDataFrame(data, item);
     }
 }
Exemplo n.º 3
0
 public IEnumerable <HttpRequest> GetWebSockets()
 {
     if (mVersion != BaseServer.Version)
     {
         mVersion = BaseServer.Version;
         ISession[] items = BaseServer.GetOnlines();
         mOnlines = from s in items
                    where ((HttpToken)s.Tag).WebSocket
                    select((HttpToken)s.Tag).WebSocketRequest;
     }
     return(mOnlines);
 }