Exemplo n.º 1
0
 public NotificationCenterWebSocketWriter(WebSocket webSocket, NotificationsBase notificationsBase, IMemoryContextPool contextPool, CancellationToken resourceShutdown)
 {
     _notificationsBase = notificationsBase;
     _contextPool       = contextPool;
     _resourceShutdown  = resourceShutdown;
     _webSocket         = webSocket;
 }
Exemplo n.º 2
0
 public ClusterDashboardConnection(WebSocket webSocket, CanAccessDatabase canAccessDatabase, ClusterDashboardNotifications clusterDashboardNotifications,
                                   IMemoryContextPool contextPool, CancellationToken resourceShutdown)
     : base(webSocket, clusterDashboardNotifications, contextPool, resourceShutdown)
 {
     _canAccessDatabase             = canAccessDatabase;
     _clusterDashboardNotifications = clusterDashboardNotifications;
     _returnReadContext             = contextPool.AllocateOperationContext(out _readContext);
 }
Exemplo n.º 3
0
        public ProxyWebSocketConnection(WebSocket localWebSocket, string nodeUrl, string websocketEndpoint, IMemoryContextPool contextPool, CancellationToken token)
        {
            if (string.IsNullOrEmpty(nodeUrl))
            {
                throw new ArgumentException("Node url cannot be null or empty", nameof(nodeUrl));
            }

            if (string.IsNullOrEmpty(websocketEndpoint))
            {
                throw new ArgumentException("Endpoint cannot be null or empty", nameof(websocketEndpoint));
            }

            if (websocketEndpoint.StartsWith("/") == false)
            {
                throw new ArgumentException("Endpoint must starts with '/' character", nameof(websocketEndpoint));
            }

            _localWebSocket     = localWebSocket;
            _nodeUrl            = nodeUrl;
            _contextPool        = contextPool;
            _cts                = CancellationTokenSource.CreateLinkedTokenSource(token);
            _remoteWebSocketUri = new Uri($"{nodeUrl.Replace("http", "ws", StringComparison.OrdinalIgnoreCase)}{websocketEndpoint}");
            _remoteWebSocket    = new ClientWebSocket();
        }
Exemplo n.º 4
0
 public NotificationCenterWebSocketWriter(WebSocket webSocket, NotificationsBase notificationsBase, IMemoryContextPool contextPool, CancellationToken resourceShutdown)
 {
     _webSocket         = webSocket;
     _notificationsBase = notificationsBase;
     contextPool.AllocateOperationContext(out _context);
     _resourceShutdown = resourceShutdown;
 }