Пример #1
0
        private Emitter(ConnectionMultiplexer redisClient, EmitterOptions options, IStreamReader streamReader)
        {
            if (redisClient == null)
            {
                InitClient(options);
            }
            else
            {
                _redisClient = redisClient;
            }

            _prefix = (!string.IsNullOrWhiteSpace(options.Key) ? options.Key : "socket.io");

            _version = options.Version;

            if (_version == EmitterOptions.EVersion.V0_9_9)
            {
                _prefix += "#emitter";
            }


            _rooms        = Enumerable.Empty <string>().ToList();
            _flags        = new Dictionary <string, object>();
            _streamReader = streamReader;
        }
Пример #2
0
        /// <summary>
        /// Create a redis client from a `host:port` uri string.
        /// </summary>
        /// <param name="options">Emitter options</param>
        private void InitClient(EmitterOptions options)
        {
            if (string.IsNullOrWhiteSpace(options.Host))
            {
                throw new Exception("Missing redis 'host'");
            }
            if (options.Port == default(int))
            {
                throw new Exception("Missing redis 'port'");
            }

            _redisClient = ConnectionMultiplexer.Connect(string.Format("{0}:{1}", options.Host, options.Port));
        }
Пример #3
0
 public Emitter(EmitterOptions options)
     : this(null, options, new StreamReader())
 {
 }
Пример #4
0
 public Emitter(ConnectionMultiplexer redisClient, EmitterOptions options)
     : this(redisClient, options, new StreamReader())
 {
 }