/// <summary> /// Create TCP session factory method /// </summary> /// <returns>TCP session</returns> protected virtual WsSession CreateSession() { var newSession = new WsSession(this); if (OnSessionError != null) { newSession.OnSessionError += OnSessionError; } if (OnMessageSent != null) { newSession.OnMessageSent += OnMessageSent; } if (OnMessageReceived != null) { newSession.OnMessageReceived += OnMessageReceived; } if (OnEmptyMessage != null) { newSession.OnEmptyMessage += OnEmptyMessage; } return(newSession); }
internal void OnDisconnectedInternal(WsSession session) { OnDisconnected(session); }
/// <summary> /// Handle session disconnected notification /// </summary> /// <param name="session">Disconnected session</param> protected virtual void OnDisconnected(WsSession session) { OnSessionDisconnected?.Invoke(session, new ConnectionEventArgs(session.Id)); }
/// <summary> /// Register a new session /// </summary> /// <param name="session">Session to register</param> internal void RegisterSession(WsSession session) { // Register a new session Sessions.TryAdd(session.Id, session); }