BrowserTerminalHostServer class final
Reusable browser host server for remote TUI sessions.
This helper serves a default xterm.js client page and upgrades websocket connections for terminal sessions. Use bind for custom session handling or serveProgram to host a Model directly.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- onSession → BrowserTerminalSessionHandler
-
final
- pageHtml → String
-
HTML served at pagePath.
final
- pagePath → String
-
Path used for the client page.
final
- pageUri → Uri
-
URL for the served browser page.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- server → HttpServer
-
The underlying HTTP server.
final
- webSocketPath → String
-
Path used for websocket upgrades.
final
- webSocketUri → Uri
-
URL for websocket terminal sessions.
no setter
Methods
-
close(
{bool force = false}) → Future< void> - Closes the underlying HTTP server.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
bind(
{InternetAddress? address, int port = 8080, String pagePath = '/', String webSocketPath = '/ws', String title = 'Artisanal Browser Host', String? pageHtml, required BrowserTerminalSessionHandler onSession}) → Future< BrowserTerminalHostServer> - Binds a browser host server.
-
defaultPageHtml(
{required String title, required String webSocketPath, String background = '#101318', String foreground = '#e6edf3', String cursor = '#58a6ff', String selectionBackground = '#334155', String lightBackground = '#f8fafc', String lightForeground = '#0f172a', String lightCursor = '#2563eb', String lightSelectionBackground = '#cbd5e1'}) → String - Builds a default xterm.js browser page for websocket-backed terminal sessions.
-
serveProgram<
M extends Model> ({InternetAddress? address, int port = 8080, String pagePath = '/', String webSocketPath = '/ws', String title = 'Artisanal Browser Host', String? pageHtml, required M modelBuilder(), ProgramOptions options = const ProgramOptions(altScreen: false, frameTick: false, signalHandlers: false)}) → Future< BrowserTerminalHostServer> - Binds a browser host server that runs a fresh program per websocket.