internal string Add(WebSocketSession service) { lock (_syncRoot) { if (_isStopped) return null; var id = createID(); _services.Add(id, service); return id; } }
/// <summary> /// Tries to get the <see cref="WebSocketSession"/> associated with the specified <paramref name="id"/>. /// </summary> /// <returns> /// <c>true</c> if the <see cref="WebSocketSessionManager"/> manages the <see cref="WebSocketSession"/> 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="WebSocketSession"/> with the specified <paramref name="id"/>, if the <paramref name="id"/> is found; otherwise, <see langword="null"/>. /// </param> public bool TryGetWebSocketService(string id, out WebSocketSession service) { lock (_syncRoot) { return _services.TryGetValue(id, out service); } }