public SenderGatewayService() { _server = new ObservableListenerServer("http://*:81/"); _senderGateway = new SenderGateway(Auth); _senderGateway.Subscribe(x => { Console.Out.WriteLineAsync( $"{x.Channel} IsBinary:{x.IsBinary} IsClose:{x.IsClose} {string.Join("-", x.ReceiveData.Select(y => y.ToString("x2")))}"); }); }
public ReceiverGatawayService() { ObservableSoundCapture capture = new ObservableSoundCapture(); ObservableSpeexEncoder encoder = new ObservableSpeexEncoder(6400); capture.Subscribe(encoder); var encoderSender = encoder.Delay(TimeSpan.FromMilliseconds(3000)).Select(x => new SenderModel("TestChannel", true, x)); capture.Start(); _server = new ObservableListenerServer("http://*:81/"); var timer = Observable.Interval(TimeSpan.FromMilliseconds(100)) .Select(x => new SenderModel("TestChannel", false, Encoding.ASCII.GetBytes(x.ToString()))) .Publish() ; timer.Connect(); _gateway = new ReceiverGateway(Auth); encoderSender.Subscribe(_gateway); }