Skip to main content
Version: 4.x

DarkWS.ConnectionStorage

DarkWS​

DarkWS​

ConnectionStorage Class​

Thread-safe local registry with session and group indexes. Re-add a connection to refresh externally changed membership.

public sealed class ConnectionStorage

Inheritance System.Object → ConnectionStorage

Methods​

ConnectionStorage.Add(IWebSocketConnection) Method​

Adds or replaces a connection by id and refreshes its session/group indexes.

public DarkWS.Abstractions.IWebSocketConnection Add(DarkWS.Abstractions.IWebSocketConnection connection);

Parameters​

connection IWebSocketConnection

Returns​

IWebSocketConnection

ConnectionStorage.GetAll() Method​

Returns a snapshot of every local connection.

public System.Collections.Generic.IReadOnlyCollection<DarkWS.Abstractions.IWebSocketConnection> GetAll();

Returns​

System.Collections.Generic.IReadOnlyCollection<IWebSocketConnection>

ConnectionStorage.GetByConnection(string) Method​

Returns the matching connection or an empty snapshot.

public System.Collections.Generic.IReadOnlyCollection<DarkWS.Abstractions.IWebSocketConnection> GetByConnection(string connectionId);

Parameters​

connectionId System.String

Returns​

System.Collections.Generic.IReadOnlyCollection<IWebSocketConnection>

ConnectionStorage.GetByGroup(string) Method​

Returns indexed group members; work is proportional to the matching connections.

public System.Collections.Generic.IReadOnlyCollection<DarkWS.Abstractions.IWebSocketConnection> GetByGroup(string group);

Parameters​

group System.String

Returns​

System.Collections.Generic.IReadOnlyCollection<IWebSocketConnection>

ConnectionStorage.GetBySession(string) Method​

Returns indexed session members; work is proportional to the matching connections.

public System.Collections.Generic.IReadOnlyCollection<DarkWS.Abstractions.IWebSocketConnection> GetBySession(string sessionId);

Parameters​

sessionId System.String

Returns​

System.Collections.Generic.IReadOnlyCollection<IWebSocketConnection>

ConnectionStorage.Remove(IWebSocketConnection) Method​

Removes this exact connection and its indexes; returns false when absent or replaced.

public bool Remove(DarkWS.Abstractions.IWebSocketConnection connection);

Parameters​

connection IWebSocketConnection

Returns​

System.Boolean