Namespace: handler
Interfaces
Type Aliases
ApiResponse
Ƭ ApiResponse: ApiResponseOk
| ApiResponseError
Functions
createServerHandler
▸ createServerHandler<RequestT
, ResponseT
>(config
): lambda.ApiGatewayHandler
Helper for creating FB authenticated game server handlers. The allowed app secrets should be
defined in FB_SECRETS
environment variable.
Type parameters
Name | Type |
---|---|
RequestT |
RequestT |
ResponseT |
extends ApiResponse |
Parameters
Name | Type | Description |
---|---|---|
config |
ServerHandlerConfig <RequestT , ResponseT > |
Server handler configuration |
Returns
lambda.ApiGatewayHandler
createWebSocketAuthHandler
▸ createWebSocketAuthHandler<AuthPayload
>(config
): lambda.ApiGatewayHandler
Helper for creating FB authenticated WebSocket authentication handler. The allowed app secrets
should be defined in FB_SECRETS
environment variable.
As opposed to the regular server API handlers the WebSocket connections should be authenticated only once. The game server is responsible for storing the authentication information for the connection id / player id pairs.
Type parameters
Name |
---|
AuthPayload |
Parameters
Name | Type | Description |
---|---|---|
config |
WebSocketAuthHandlerConfig <AuthPayload > |
WebSocket handler configuration |
Returns
lambda.ApiGatewayHandler
createWebSocketHandler
▸ createWebSocketHandler<T
>(config
): lambda.ApiGatewayHandler
Helper for creating a game server WebSocket handler. The message interface is expected to
contain an optional id
number which will be used to send back an automatic ack
response.
This allows the client to re-send the message until the server confirms it is received.
NOTE: The automatic retry/ack system means the handler must be idempotent!
Type parameters
Name | Type |
---|---|
T |
extends ClientAckMessage |
Parameters
Name | Type | Description |
---|---|---|
config |
WebSocketHandlerConfig <T > |
WebSocket handler configuration |
Returns
lambda.ApiGatewayHandler
createWebhookHandler
▸ createWebhookHandler(config
): lambda.ApiGatewayHandler
Helper for creating FB authenticated bot webhook handlers. The allowed app secrets should be
defined in FB_SECRETS
environment variable.
Parameters
Name | Type | Description |
---|---|---|
config |
WebhookHandlerConfig |
Server handler configuration |
Returns
lambda.ApiGatewayHandler