public ReceiveStream(WebSocketConnectionManager webSocketConnectionManager, StreamQueueManager streamManager) : base(webSocketConnectionManager, streamManager)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                          .AddEnvironmentVariables();
            var config = builder.Build();
            var path   = config["path:privateKey"];

            try
            {
                using (var reader = File.OpenText(path))
                {
                    _keyPair = (AsymmetricCipherKeyPair) new PemReader(reader).ReadObject();
                }
            }
            catch (FileNotFoundException e)
            {
                Console.WriteLine("Private key file not found at {0}! Please check application config and private key file.", path);
                Environment.Exit(FILE_NOT_FOUND);
            }

            //Get public key
            TextWriter textWriter = new StringWriter();
            PemWriter  pemWriter  = new PemWriter(textWriter);

            pemWriter.WriteObject(_keyPair.Public);
            pemWriter.Writer.Flush();
            _pubKey = textWriter.ToString();
            textWriter.Flush();

            Clients = new Dictionary <string, string>();
        }
Exemple #2
0
 public ChatStream(WebSocketConnectionManager webSocketConnectionManager, StreamQueueManager streamManager) : base(webSocketConnectionManager, streamManager)
 {
     Clients = new ConcurrentDictionary <string, List <string> >();
 }
Exemple #3
0
 public VideoStream(WebSocketConnectionManager webSocketConnectionManager, StreamQueueManager streamManager) : base(webSocketConnectionManager, streamManager)
 {
 }