Esempio n. 1
0
        public RiasWebSocket(IWebsocketConfiguration config, string source)
        {
            _config = config;
            var connectionType = config.IsSecureConnection ? "wss" : "ws";

            _hostUri = new Uri($"{connectionType}://{config.WebSocketHost}:{config.WebSocketPort}/{config.UrlParameters}");
            _source  = source;
        }
        public SuperWebsocketManager(IWebsocketConfiguration configuration)
        {
            this.websocketConfiguration = configuration;
            this.Id = Guid.NewGuid();

            this._connectedSocketSessions = new ConcurrentDictionary<string, WebSocketSession>();

            this._appServer.Setup(configuration.Port);

            if (!this._appServer.Start())
                throw new ArgumentException("Couldn't start service");

            this._appServer.NewMessageReceived += this.AppServerNewMessageReceived;
            this._appServer.NewSessionConnected += this.AppServerNewSessionConnected;
            this._appServer.SessionClosed += this.AppServerSessionClosed;
        }