コード例 #1
0
 private static string GetCorrelationUrl(this IServeWebSockets service, ShortGuid correlationId) {
   return $"{service.BaseUri}{correlationId.GetCorrelationEndpoint()}";
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 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;
 }
コード例 #4
0
 public static Uri GetCorrelationUri(this IServeWebSockets service, ShortGuid correlationId) {
   return new Uri(service.GetCorrelationUrl(correlationId));
 }
コード例 #5
0
 public static void RemoveCorrelationService(this IServeWebSockets service, ShortGuid correlationId) {
   service.Server.RemoveWebSocketService(correlationId.GetCorrelationEndpoint(leadingForwardSlash: true));
 }
コード例 #6
0
 public static void AddCorrelationService(this IServeWebSockets service, ShortGuid correlationId) {
   service.Server.AddWebSocketService(correlationId.GetCorrelationEndpoint(leadingForwardSlash: true),
     () => new Correlation(correlationId));
 }