Ejemplo n.º 1
0
 public WebSocketListener(Uri uri, WebSocketTransportSettings settings, ILoggerFactory loggerFactory)
 {
     _uri            = uri;
     _socketSettings = settings;
     _loggerFactory  = loggerFactory;
     _logger         = _loggerFactory.CreateLogger(nameof(WebSocketListener));
 }
Ejemplo n.º 2
0
        public WebSocketTransport(Uri uri, WebSocketTransportSettings settings, ILoggerFactory loggerFactory)
            : base(settings, ConnectionSide.Server, loggerFactory.CreateLogger(nameof(WebSocketTransport)))
        {
            var transport = new WebSocketChannel(uri, this.ConnectionName);

            _channel = CreateChannel(transport, settings);
        }
Ejemplo n.º 3
0
        IMessageChannel CreateChannel(ITransportChannel transport, WebSocketTransportSettings settings)
        {
            var framing = settings.FramingProtocol;

            switch (framing)
            {
            case FramingProtocol.SerialFragments: return(new SerialMessageStreamChannel(transport, settings));

            case FramingProtocol.ConcurrentFragments: return(new ConcurrentMessageStreamChannel(transport, settings));

            default: throw new NotSupportedException(framing.ToString());
            }
        }