Skip to content

Commit

Permalink
Fix Event for WebSocket Gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
fogfish committed Mar 17, 2024
1 parent c45387e commit c43e85d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions broker/websocket/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package websocket
import (
"context"
"log/slog"
"net/http"
"strings"

"github.com/aws/aws-lambda-go/events"
Expand Down Expand Up @@ -150,10 +151,10 @@ func (s spawner) Spawn(k *kernel.Kernel) error {
bag := []swarm.Bag{{Ctx: ctx, Object: []byte(evt.Body)}}

if err := k.Dispatch(bag, s.c.TimeToFlight); err != nil {
return events.APIGatewayProxyResponse{StatusCode: 500}, err
return events.APIGatewayProxyResponse{StatusCode: http.StatusRequestTimeout}, err
}

return events.APIGatewayProxyResponse{StatusCode: 200}, nil
return events.APIGatewayProxyResponse{StatusCode: http.StatusOK}, nil
},
)

Expand Down
4 changes: 2 additions & 2 deletions event.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ type Event[T any] struct {
//
// Unique identity for event
// It is automatically defined by the library upon the transmission
ID string `json:"@id,omitempty"`
ID string `json:"id,omitempty"`

//
// Canonical IRI that defines a type of action.
// It is automatically defined by the library upon the transmission
Type curie.IRI `json:"@type,omitempty"`
Type curie.IRI `json:"type,omitempty"`

//
// Direct performer of the event, a software service that emits action to the stream.
Expand Down

0 comments on commit c43e85d

Please sign in to comment.