Exemplo n.º 1
0
        internal RemoteJSInteropStream(
            IJSRuntime jsRuntime,
            JsRuntimeStreamInfo jsRuntimeStreamInfo,
            RemoteJsInteropStreamOptions options,
            CancellationToken cancellationToken)
            : base(jsRuntimeStreamInfo)
        {
            _jsRuntime           = jsRuntime;
            _jsRuntimeStreamInfo = jsRuntimeStreamInfo;
            _maxSegmentSize      = options.MaxSegmentSize;
            _segmentFetchTimeout = options.SegmentFetchTimeout;

            var pipe = new Pipe(new PipeOptions(pauseWriterThreshold: options.MaxBufferSize, resumeWriterThreshold: options.MaxBufferSize));

            _pipeReader    = pipe.Reader;
            _fillBufferCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);

            _ = FillBuffer(pipe.Writer, _fillBufferCts.Token);
        }
 protected JSInteropStream(JsRuntimeStreamInfo jsRuntimeStreamInfo)
 {
     JsRuntimeStreamInfo = jsRuntimeStreamInfo;
 }