Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WebServer

HTTP web game server.

PS4 instructions: the specs of the constructor, port(), start(), and stop() may not be changed; you should delete the example "hello" handler as described in the handout.

Hierarchy

  • WebServer

Index

Constructors

Accessors

Methods

Constructors

  • Make a new web game server using board that listens for connections on port.

    Parameters

    • board: Board

      shared game board

    • requestedPort: number

      server port number

    Returns WebServer

Accessors

  • get port(): number
  • Returns number

    the actual port that server is listening at. (May be different than the requestedPort used in the constructor, since if requestedPort = 0 then an arbitrary available port is chosen.) Requires that start() has already been called and completed.

Methods

  • start(): Promise<void>
  • Start this server.

    Returns Promise<void>

    (a promise that) resolves when the server is listening

  • stop(): void
  • Stop this server. Once stopped, this server cannot be restarted.

    Returns void

Generated using TypeDoc