WebSocketTextWriter
A TextWriter that sends UTF-8 text frames over a WebSocket. Synchronous Write(string) calls are buffered and sent on FlushAsync().
- Kind:
Class - Namespace: Repl.WebSocket
- Assembly:
Repl.WebSocket - Source: src/Repl.WebSocket/WebSocketTextWriter.cs
Signature
Section titled “Signature”public sealed class WebSocketTextWriter : TextWriter, IAsyncDisposable, IDisposableInheritance
Section titled “Inheritance”Implements
Section titled “Implements”Constructors
Section titled “Constructors”WebSocketTextWriter(WebSocket, CancellationToken)
Section titled “WebSocketTextWriter(WebSocket, CancellationToken)”A TextWriter that sends UTF-8 text frames over a WebSocket. Synchronous Write(string) calls are buffered and sent on FlushAsync().
public WebSocketTextWriter(WebSocket socket, CancellationToken cancellationToken)Parameters
Section titled “Parameters”socket(WebSocket)cancellationToken(CancellationToken)
Methods
Section titled “Methods”FlushAsync()
Section titled “FlushAsync()”Asynchronously clears all buffers for the current writer and causes any buffered data to be written to the underlying device.
public override Task FlushAsync()Returns
Section titled “Returns”Task - A task that represents the asynchronous flush operation.
Write(char)
Section titled “Write(char)”Writes a character to the text stream.
public override void Write(char value)Parameters
Section titled “Parameters”value(char): The character to write to the text stream.
Write(string?)
Section titled “Write(string?)”Writes a string to the text stream.
public override void Write(string? value)Parameters
Section titled “Parameters”value(string): The string to write.
WriteAsync(string?)
Section titled “WriteAsync(string?)”Writes a string to the text stream asynchronously.
public override Task WriteAsync(string? value)Parameters
Section titled “Parameters”value(string): The string to write. If value is null, nothing is written to the text stream.
Returns
Section titled “Returns”Task - A task that represents the asynchronous write operation.
WriteLine(string?)
Section titled “WriteLine(string?)”Writes a string to the text stream, followed by a line terminator.
public override void WriteLine(string? value)Parameters
Section titled “Parameters”value(string): The string to write. If value is null, only the line terminator is written.
WriteLineAsync(string?)
Section titled “WriteLineAsync(string?)”Asynchronously writes a string to the text stream, followed by a line terminator.
public override Task WriteLineAsync(string? value)Parameters
Section titled “Parameters”value(string): The string to write. If the value is null, only a line terminator is written.
Returns
Section titled “Returns”Task - A task that represents the asynchronous write operation.
Properties
Section titled “Properties”Encoding
Section titled “Encoding”When overridden in a derived class, returns the character encoding in which the output is written.
public override Encoding Encoding { get; }Returns
Section titled “Returns”Encoding - The character encoding in which the output is written.