Show / Hide Table of Contents

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 WebSocket attribute 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::Stage and Module::WebSocket::Deployment reference the WebSocket stage and deployment, respectively.

Required: Yes

Type: String

ApiKeyRequired

The ApiKeyRequired attribute indicates whether the route requires clients to submit a valid API key.

NOTE: this setting only applies to the $connect route.

Required: No

Type: Boolean

AuthorizationType

The AuthorizationType attribute indicates the authorization type for the route. Valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer.

Required: No (Default: NONE)

Type: String

AuthorizationScopes

The AuthorizationScopes attribute holds the authorization scopes supported by this route.

Required: No

Type: List of String

AuthorizerId

The AuthorizerId attribute holds the identifier of the Authorizer resource associated with this route.

Required: Conditional (Required when AuthorizerType is CUSTOM)

Type: String

Invoke

The Invoke attribute holds the name of a C# method to invoke in the Lambda function implementation. The Lambda function implementation must derive from the ALambdaApiGatewayFunction class.

Required: No

Type: String

OperationName

The OperationName attribute holds a friendly operation name for the route.

NOTE: this attribute inherits the value of Invoke when 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
In This Article
Back to top Generated by DocFX