Provides the basic functions of the WebSocket service used by the WebSocket service host.
The WebSocketService class is an abstract class.
Inheritance: IWebSocketSession
 /// <summary>
 /// Tries to get the <see cref="WebSocketService"/> associated with the specified <paramref name="id"/>.
 /// </summary>
 /// <returns>
 /// <c>true</c> if the <see cref="WebSocketServiceManager"/> manages the <see cref="WebSocketService"/> with the specified <paramref name="id"/>; otherwise, <c>false</c>.
 /// </returns>
 /// <param name="id">
 /// A <see cref="string"/> that contains the ID to find.
 /// </param>
 /// <param name="service">
 /// When this method returns, contains the <see cref="WebSocketService"/> with the specified <paramref name="id"/>, if the <paramref name="id"/> is found; otherwise, <see langword="null"/>.
 /// </param>
 public bool TryGetWebSocketService(string id, out WebSocketService service)
 {
     lock (_syncRoot)
     {
         return(_services.TryGetValue(id, out service));
     }
 }
Exemple #2
0
 public bool TryGetByID(string id, out WebSocketService service)
 {
     lock (_syncRoot)
     {
         return _sessions.TryGetValue(id, out service);
     }
 }
        public void Clear()
        {
            ID = default(int);
            sClient = null;

            //User.Logout();

            User = null;
        }
Exemple #4
0
        public string Add(WebSocketService service)
        {
            lock (_syncRoot)
            {
                if (_isStopped)
                    return null;

                var id = createID();
                _sessions.Add(id, service);

                return id;
            }
        }
        internal string Add(WebSocketService service)
        {
            lock (_syncRoot)
            {
                if (_isStopped)
                {
                    return(null);
                }

                var id = createID();
                _services.Add(id, service);

                return(id);
            }
        }
Exemple #6
0
        public string Add(WebSocketService service)
        {
            lock (_syncRoot)
            {
                if (_isSJdped)
                {
                    return(null);
                }

                var id = createID();
                _sessions.Add(id, service);

                return(id);
            }
        }
 public Session(WebSocketService _cl)
 {
     sClient = _cl;
     User = new User(ID);
 }
        internal string Add(WebSocketService service)
        {
            lock (_syncRoot)
              {
            if (_isStopped)
              return null;

            var id = createID();
            _services.Add(id, service);

            return id;
              }
        }
 /// <summary>
 /// Tries to get the <see cref="WebSocketService"/> associated with the specified <paramref name="id"/>.
 /// </summary>
 /// <returns>
 /// <c>true</c> if the <see cref="WebSocketServiceManager"/> manages the <see cref="WebSocketService"/> with the specified <paramref name="id"/>; otherwise, <c>false</c>.
 /// </returns>
 /// <param name="id">
 /// A <see cref="string"/> that contains the ID to find.
 /// </param>
 /// <param name="service">
 /// When this method returns, contains the <see cref="WebSocketService"/> with the specified <paramref name="id"/>, if the <paramref name="id"/> is found; otherwise, <see langword="null"/>.
 /// </param>
 public bool TryGetWebSocketService(string id, out WebSocketService service)
 {
     lock (_syncRoot)
       {
     return _services.TryGetValue(id, out service);
       }
 }
Exemple #10
0
        internal void StartSession(WebSocketContext context)
        {
            WebSocketService webSocketService = this.CreateSession();

            webSocketService.Start(context, this.Sessions);
        }
Exemple #11
0
 public static void register_service(string name, WebSocketService wss)
 {
     service_dic[name] = wss;
 }
 internal bool TryGetServiceInstance(string id, out WebSocketService service)
 {
     lock (_sync)
       {
     return _sessions.TryGetValue (id, out service);
       }
 }
        internal string Add(WebSocketService session)
        {
            lock (_sync)
              {
            if (_stopped)
              return null;

            var id = createID ();
            _sessions.Add (id, session);

            return id;
              }
        }
Exemple #14
0
        public string Add(WebSocketService service)
        {
            lock (_syncRoot)
            {
                if (_isSJdped)
                    return null;

                var id = createID();
                _sessions.Add(id, service);

                return id;
            }
        }