Module: Main

A collection of private functions, run automatically when the app starts, for creating our Koa app and HTTP and WS servers.

Source:

Methods

(private, inner) createTeamster()

Start 1 or more web processes running our app.

Source:

(private, inner) onClose(client)

Handle a client's socket closing.

Parameters:
Name Type Description
client Client

The client whose socket has closed.

Source:

(private, inner) onConnection(socket)

Handle a newly connected WebSocket connection

Parameters:
Name Type Description
socket WS.WebSocket

The new WebSocket connection

Source:

(private, inner) onMessage(client, message)

Handle a message sent by a client.

Parameters:
Name Type Description
client Client

The client that sent the message

message string

The message sent by the client

Source:

(private, inner) startServers()

Start HTTP and WS servers for our app.

Source:

(private, inner) startWSServer(httpServer)

Start a WS server for handling WebSocket connections.

Parameters:
Name Type Description
httpServer HTTP.Server

The httpServer to attach the WS server to

Source: