algnhsa
algnhsa copied to clipboard
Added APIGatewayWebsocketRequest type
@akrylysov Figured we would want to support this...
@akrylysov I am going to mark this as a draft for now. There will need to be some special opts for handling $connect
and $disconnect
event types for the websocket gateway proxy requests. The events come in really bare, so you basically only have event.requestContext.eventType == "CONNECT"
to switch on... but we could switch on event.requestContext.routeKey == $connect
depending on how we decide to handle these cases.
In my use case I need to perform a little auth validation and record an access event to the logs, so I define my $connect
handler, but if you leave this undefined in your gateway, AWS will handle connect/disconnect events for you.
Since this package aims to fabricate an http request from the event details, the opt
, could be more than one, will need to provide httpMethod
and path
for a given eventType/routeKey
.
If you have any opinions or feedback, please let me know.
I took some liberties, but please let me know if you have change requests.
@akrylysov could you review this PR please? It would be very helpful! Thanks
Thanks for the PR! Do you mind adding some tests? Take a look at https://github.com/akrylysov/algnhsa/blob/master/adapter_test.go