ws

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticatedMessage

type AuthenticatedMessage struct {
	Action   string `json:"action"`
	DriverID int64  `json:"driverId"`
}

AuthenticatedMessage is a message that includes the driver ID for auth verification

type ConnectionLookup

type ConnectionLookup interface {
	GetConnectionsByDriver(ctx context.Context, driverID int64) ([]store.WebSocketConnection, error)
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(disconnectHandler, authHandler, pingHandler RouteHandler) *Handler

type Message

type Message struct {
	Action  string `json:"action"`
	Payload any    `json:"payload,omitempty"`
}

type Pusher

type Pusher struct {
	// contains filtered or unexported fields
}

func NewPusher

func NewPusher(client APIGatewayManagementClient, connectionLookup ConnectionLookup) *Pusher

func (*Pusher) Broadcast

func (p *Pusher) Broadcast(ctx context.Context, driverID int64, actionType string, payload any) error

Broadcast sends a message to all active connections for a given driver.

func (*Pusher) Disconnect

func (p *Pusher) Disconnect(ctx context.Context, connectionID string)

Disconnect closes a WebSocket connection.

func (*Pusher) Push

func (p *Pusher) Push(ctx context.Context, connectionID string, actionType string, payload any) (bool, error)

Push dispatches messages in a consistent format. When the connection is valid true, nil will be returned, but if the message could not be delivered due to the connection being disconnected false, nil will be returned.

type RouteHandler

type RouteHandler interface {
	HandleRequest(ctx context.Context, request events.APIGatewayWebsocketProxyRequest) (events.APIGatewayProxyResponse, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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