serveProgram<M extends Model> static method
Future<SocketTerminalHostServer>
serveProgram<M extends Model>({
- InternetAddress? address,
- int port = 2323,
- bool v6Only = false,
- TerminalDimensions initialSize = (width: 80, height: 24),
- bool supportsAnsi = true,
- ColorProfile colorProfile = ColorProfile.trueColor,
- required M modelBuilder(),
- ProgramOptions options = const ProgramOptions(altScreen: false, frameTick: false, signalHandlers: false),
Binds a socket host server that runs a fresh program per connection.
Implementation
static Future<SocketTerminalHostServer> serveProgram<M extends Model>({
io.InternetAddress? address,
int port = 2323,
bool v6Only = false,
bool shared = false,
TerminalDimensions initialSize = const (width: 80, height: 24),
bool supportsAnsi = true,
ColorProfile colorProfile = ColorProfile.trueColor,
required M Function() modelBuilder,
ProgramOptions options = const ProgramOptions(
altScreen: false,
frameTick: false,
signalHandlers: false,
),
}) {
return bind(
address: address,
port: port,
v6Only: v6Only,
shared: shared,
onSession: (socket) async {
await runProgram(
modelBuilder(),
options: options,
host: ProgramHost.socket(
socket,
initialSize: initialSize,
supportsAnsi: supportsAnsi,
colorProfile: colorProfile,
closeSocketOnDispose: false,
),
);
},
);
}