WebSocket Source
The LambdaSharp CLI uses the API Gateway Lambda Proxy Integration to invoke Lambda functions from API Gateway. See Web Socket sample for an example of how to use the WebSocket source.
Syntax
WebSocket: String
OperationName: String
ApiKeyRequired: Boolean
AuthorizationType: String
AuthorizationScopes:
- String
AuthorizerId: String
Invoke: String
Properties
Api-
The
WebSocketattribute specifies the WebSocket route that is mapped to the Lambda function. The WebSocket instance and the WebSocket resources are automatically created for the module when an WebSocket source is used.NOTE: The WebSocket resource can be referenced by its name
Module::WebSocket. Similarly,Module::WebSocket::StageandModule::WebSocket::Deploymentreference the WebSocket stage and deployment, respectively.Required: Yes
Type: String
ApiKeyRequired-
The
ApiKeyRequiredattribute indicates whether the route requires clients to submit a valid API key.NOTE: this setting only applies to the
$connectroute.Required: No
Type: Boolean
AuthorizationType-
The
AuthorizationTypeattribute indicates the authorization type for the route. Valid values areNONEfor open access,AWS_IAMfor using AWS IAM permissions, andCUSTOMfor using a Lambda authorizer.Required: No (Default:
NONE)Type: String
AuthorizationScopes-
The
AuthorizationScopesattribute holds the authorization scopes supported by this route.Required: No
Type: List of String
AuthorizerId-
The
AuthorizerIdattribute holds the identifier of theAuthorizerresource associated with this route.Required: Conditional (Required when
AuthorizerTypeisCUSTOM)Type: String
Invoke-
The
Invokeattribute holds the name of a C# method to invoke in the Lambda function implementation. The Lambda function implementation must derive from theALambdaApiGatewayFunctionclass.Required: No
Type: String
OperationName-
The
OperationNameattribute holds a friendly operation name for the route.NOTE: this attribute inherits the value of
Invokewhen not set.Required: No
Type: String
Examples
A LambdaFunction can respond to multiple WebSocket routes at once.
Sources:
- WebSocket: $connect
ApiKeyRequired: true
- WebSocket: $disconnect
- WebSocket: addItem
Invoke: AddItem
- WebSocket: deleteItem
Invoke: RemoveItem