Skip to content

Added APIGatewayWebsocketRequest type - #28

Open
requaos wants to merge 7 commits into
akrylysov:masterfrom
requaos:requaos/wss
Open

requaos wants to merge 7 commits into
akrylysov:masterfrom
requaos:requaos/wss

Conversation

@requaos

@requaos requaos commented Nov 12, 2020

Copy link
Copy Markdown

No description provided.

@requaos

requaos commented Nov 12, 2020

Copy link
Copy Markdown
Author

@akrylysov Figured we would want to support this...

requaos and others added 3 commits November 12, 2020 10:17
Added APIGatewayWebsocketRequest type
added pkg/errors to wrap the error with the payload message so it pri…
@requaos

requaos commented Nov 12, 2020

Copy link
Copy Markdown
Author

@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.

@requaos
requaos marked this pull request as draft November 12, 2020 23:21
@requaos

requaos commented Nov 16, 2020

Copy link
Copy Markdown
Author

I took some liberties, but please let me know if you have change requests.

@requaos
requaos marked this pull request as ready for review November 16, 2020 19:08
@ghost

ghost commented Mar 4, 2021

Copy link
Copy Markdown

@akrylysov could you review this PR please? It would be very helpful!
Thanks

@akrylysov

Copy link
Copy Markdown
Owner

Thanks for the PR! Do you mind adding some tests? Take a look at https://github.com/akrylysov/algnhsa/blob/master/adapter_test.go

@StarpTech StarpTech mentioned this pull request Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants