Skip to content

Support API Gateway websocket api via LambdaServer#1804

Open
wiowou wants to merge 2 commits into
aws:masterfrom
wiowou:websocket
Open

Support API Gateway websocket api via LambdaServer#1804
wiowou wants to merge 2 commits into
aws:masterfrom
wiowou:websocket

Conversation

@wiowou
Copy link
Copy Markdown

@wiowou wiowou commented Sep 5, 2024

Issue #, if available:

Description of changes:
Added a websocket option to the Amazon.Lambda.AspNetCoreServer project so that API Gateway websocket api's can also use the LambdaServer (DI, controllers, etc) given the user does the following:

  1. References the same lambda to handle the RouteKeys in API Gateway for which they have controller routes set up.
  2. Sets up controller routes as POST with path=RouteKey

Unit tests are passing.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@bhoradc
Copy link
Copy Markdown

bhoradc commented Sep 27, 2024

Hi @wiowou,

Thank you for contributing the PR. Our team will review it and get back to you as soon we can.

Regards,
Chaitanya

@wiowou
Copy link
Copy Markdown
Author

wiowou commented Sep 30, 2024

Thank you, @bhoradc !

-Behram

@GarrettBeatty GarrettBeatty requested a review from Copilot May 12, 2026 18:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for API Gateway WebSocket API events to be processed through Amazon.Lambda.AspNetCoreServer so WebSocket RouteKeys can be routed into ASP.NET Core controllers / DI via LambdaServer.

Changes:

  • Introduces APIGatewayWebsocketApiProxyFunction (and typed TStartup variant) to translate WebSocket events into ASP.NET Core requests (POST + path from RouteKey).
  • Refactors APIGatewayProxyFunction to allow overriding HTTP path/method/header derivation and adds ConnectionId propagation.
  • Adds a test web app controller + request fixture + unit test validating routing/serialization behavior.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
Libraries/test/TestWebApp/WebsocketApiLambdaFunction.cs Adds a test Lambda entrypoint using the new WebSocket proxy base class.
Libraries/test/TestWebApp/Controllers/RouteKeyController.cs Adds a controller route simulating API Gateway RouteKey routing via POST.
Libraries/test/Amazon.Lambda.AspNetCoreServer.Test/values-post-withbody-websocketapi-request.json Adds a sample WebSocket event payload fixture for tests.
Libraries/test/Amazon.Lambda.AspNetCoreServer.Test/TestApiGatewayWebsocketApiCalls.cs Adds a unit test invoking the WebSocket proxy function end-to-end.
Libraries/test/Amazon.Lambda.AspNetCoreServer.Test/Amazon.Lambda.AspNetCoreServer.Test.sln Adds a solution file for the test project.
Libraries/src/Amazon.Lambda.AspNetCoreServer/APIGatewayWebsocketApiProxyFunction{TStartup}.cs Adds the typed Startup variant for WebSocket proxy functions.
Libraries/src/Amazon.Lambda.AspNetCoreServer/APIGatewayWebsocketApiProxyFunction.cs Adds the WebSocket proxy implementation (path/method/headers).
Libraries/src/Amazon.Lambda.AspNetCoreServer/APIGatewayProxyFunction.cs Refactors request marshalling to use overridable parsing hooks; propagates ConnectionId.
Libraries/src/Amazon.Lambda.AspNetCoreServer.Hosting/ServiceCollectionExtensions.cs Adds new LambdaEventSource.WebsocketApi wiring to runtime server selection.
Libraries/src/Amazon.Lambda.AspNetCoreServer.Hosting/Internal/LambdaRuntimeSupportServer.cs Adds runtime support server for WebSocket API Minimal API hosting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +24 to +26
/// <summary>
///
/// </summary>
@wiowou wiowou requested review from a team as code owners May 13, 2026 00:54
@GarrettBeatty
Copy link
Copy Markdown
Collaborator

GarrettBeatty commented May 14, 2026

hi thanks for the pr. can you rebase it on top of dev branch and change the target branch to dev please?

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.

4 participants