private static string GetCorrelationUrl(this IServeWebSockets service, ShortGuid correlationId) { return $"{service.BaseUri}{correlationId.GetCorrelationEndpoint()}"; }
public static WebSocket CreateCorrelationClient(this IServeWebSockets service, ShortGuid correlationId, bool connect = true) { var client = new WebSocket(service.GetCorrelationUrl(correlationId)); if (connect) client.Connect(); return client; }
public static bool IsCorrelationService(this IServeWebSockets service, ShortGuid correlationId) { var endpoint = correlationId.GetCorrelationEndpoint(leadingForwardSlash: true); var isService = service.Server.WebSocketServices.Paths.Any(x => string.Equals(x, endpoint, StringComparison.OrdinalIgnoreCase)); return isService; }
public static Uri GetCorrelationUri(this IServeWebSockets service, ShortGuid correlationId) { return new Uri(service.GetCorrelationUrl(correlationId)); }
public static void RemoveCorrelationService(this IServeWebSockets service, ShortGuid correlationId) { service.Server.RemoveWebSocketService(correlationId.GetCorrelationEndpoint(leadingForwardSlash: true)); }
public static void AddCorrelationService(this IServeWebSockets service, ShortGuid correlationId) { service.Server.AddWebSocketService(correlationId.GetCorrelationEndpoint(leadingForwardSlash: true), () => new Correlation(correlationId)); }