Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIGatewayClient ¶
type APIGatewayClient interface {
PostToConnection(ctx context.Context, params *apigatewaymanagementapi.PostToConnectionInput, optFns ...func(*apigatewaymanagementapi.Options)) (*apigatewaymanagementapi.PostToConnectionOutput, error)
}
APIGatewayClient interface for testing.
type ClientMessage ¶
ClientMessage is what the client sends after connecting.
type DynamoDBClient ¶
type DynamoDBClient interface {
PutItem(ctx context.Context, params *dynamodb.PutItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.PutItemOutput, error)
DeleteItem(ctx context.Context, params *dynamodb.DeleteItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.DeleteItemOutput, error)
Scan(ctx context.Context, params *dynamodb.ScanInput, optFns ...func(*dynamodb.Options)) (*dynamodb.ScanOutput, error)
}
DynamoDBClient interface for testing.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler processes API Gateway WebSocket events.
func NewDefaultHandler ¶
NewDefaultHandler creates a Handler using real AWS clients from environment.
func NewHandler ¶
func NewHandler(db DynamoDBClient, apiGW APIGatewayClient, table string) *Handler
NewHandler creates a new Handler with the given clients and table name.
func (*Handler) HandleRequest ¶
func (h *Handler) HandleRequest(ctx context.Context, event events.APIGatewayWebsocketProxyRequest) (events.APIGatewayProxyResponse, error)
HandleRequest routes the WebSocket event to the appropriate handler.
type MatchResult ¶
type MatchResult struct {
OpponentAddr string `json:"opponent_addr"`
OpponentName string `json:"opponent_name"`
IsHost bool `json:"is_host"`
}
MatchResult is sent to both matched players.
Click to show internal directories.
Click to hide internal directories.