lambda

package
v0.0.0-...-3f69db4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 12 Imported by: 0

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

type ClientMessage struct {
	Name string `json:"name"`
	Port int    `json:"port"`
}

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

func NewDefaultHandler(ctx context.Context) (*Handler, error)

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL