Skip to content

Class TtydConnection

A terminal served by ttyd, the program that shares a command line over a WebSocket. It speaks ttyd’s framing: the grid size when the socket opens and again on every resize, input and output marked as such, and the server’s title and preference messages dropped. Give it the server’s WebSocket address, which ends in /ws.

Declaration
public sealed class TtydConnection : WebSocketConnection, ITerminalConnection

Inheritance: System.Object -> DarkEffekt.Terminal.WebSocketConnection

Implements:
DarkEffekt.Terminal.ITerminalConnection

The credential a server started with one expects. Empty for none. Set before Connect.

Declaration
public string AuthToken { get; set; }

The socket is open. Runs before anything queued goes out and before Connected, so a message sent from here with SendRaw is the first the server reads.

Declaration
protected override void OnConnected()

Processes one message from the server. The base class raises DataReceived with it.

Declaration
protected override void HandleMessage(byte[] data)
Type Name
System.Byte[] data

Queues bytes for the far end. Never blocks on the network.

Declaration
public override void Send(byte[] data, int offset, int count)
Type Name
System.Byte[] data
System.Int32 offset
System.Int32 count

The terminal grid changed size. Connections that can pass this on do.

Declaration
public override void NotifyResize(int cols, int rows)
Type Name
System.Int32 cols
System.Int32 rows