NT4Server

constructor(port: Int = DEFAULT_PORT, host: String = "0.0.0.0", timeSource: TimeSource.WithComparableMarks = TimeSource.Monotonic, origin: ComparableTimeMark = timeSource.markNow(), routes: Routing.() -> Unit? = null)(source)

Parameters

port

The port to listen on. The standard NetworkTables 4 port is DEFAULT_PORT, and 0 picks a free one, which boundPort reports after start.

host

The address to listen on. The default is every network interface.

timeSource

The clock that timestamps are measured on. A server created on its own can use the default. To line it up with a dev.nextftc.telemetry.wpilog.WPILogWriter, give them the same source and the same origin.

origin

The moment timestamp zero refers to, a mark from timeSource. The default is the moment the server is created. Share one origin between sinks that should agree on every timestamp.

routes

Adds Ktor routes to the server, for pages or downloads on the same port. They are installed after the server's own, so they can't replace / or /nt/.... It runs each time start is called.