A generic server interface that allows us to mock the server's behavior in tests.

interface Server {
    onConnect(handler: OnConnect): void;
    start(port: number): void;
}

Implemented by

Methods

  • Register a function to be called when a new socket connects. This should be only called once per server.

    Parameters

    Returns void