Table of Contents

Interface IWebSocketService

Namespace
Virtufin.WebSocketManager.Services
Assembly
Virtufin.WebSocketManager.dll
public interface IWebSocketService

Methods

ConnectAsync(string, bool, CancellationToken)

Task<WebSocketConnection> ConnectAsync(string url, bool autoReconnect, CancellationToken cancellationToken = default)

Parameters

url string
autoReconnect bool
cancellationToken CancellationToken

Returns

Task<WebSocketConnection>

DisconnectAsync(string, CancellationToken)

Task DisconnectAsync(string id, CancellationToken cancellationToken = default)

Parameters

id string
cancellationToken CancellationToken

Returns

Task

GetTag(string, string)

string? GetTag(string id, string key)

Parameters

id string
key string

Returns

string

GetTags(string)

IReadOnlyDictionary<string, string> GetTags(string id)

Parameters

id string

Returns

IReadOnlyDictionary<string, string>

ListConnectionsAsync(CancellationToken)

Task<IEnumerable<WebSocketConnection>> ListConnectionsAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<IEnumerable<WebSocketConnection>>

ReclaimAsync(string, CancellationToken)

Takes ownership of a connection last known to be owned by another, now-unreachable instance. Unlike a fresh ConnectAsync(string, bool, CancellationToken), the connection ID and its persisted metadata (URL, auto-reconnect, topic, tags) are preserved. If auto-reconnect is set, attempts to open a fresh socket for it immediately -- the old owner's socket object lives in that process's memory, unreachable from here, so this instance genuinely has no live connection until one is (re)established. Returns false if no persisted record exists for id.

Task<bool> ReclaimAsync(string id, CancellationToken cancellationToken = default)

Parameters

id string
cancellationToken CancellationToken

Returns

Task<bool>

SendAsync(string, byte[], int, string, CancellationToken)

Task<byte[]> SendAsync(string id, byte[] message, int timeoutMs, string contentType, CancellationToken cancellationToken = default)

Parameters

id string
message byte[]
timeoutMs int
contentType string
cancellationToken CancellationToken

Returns

Task<byte[]>

SendRawAsync(string, byte[], string, CancellationToken)

Task SendRawAsync(string id, byte[] message, string contentType, CancellationToken cancellationToken = default)

Parameters

id string
message byte[]
contentType string
cancellationToken CancellationToken

Returns

Task

SetTag(string, string, string)

void SetTag(string id, string key, string value)

Parameters

id string
key string
value string

SetTags(string, IDictionary<string, string>)

void SetTags(string id, IDictionary<string, string> tags)

Parameters

id string
tags IDictionary<string, string>

StartPublishAsync(string, string, CancellationToken)

Task StartPublishAsync(string id, string topic, CancellationToken cancellationToken = default)

Parameters

id string
topic string
cancellationToken CancellationToken

Returns

Task

StopPublishAsync(string, CancellationToken)

Task StopPublishAsync(string id, CancellationToken cancellationToken = default)

Parameters

id string
cancellationToken CancellationToken

Returns

Task