Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/austoonz/powershell-core-simple-websockets-chat-app
This is a personal project created so I could learn about the websocket support in API Gateway.
https://github.com/austoonz/powershell-core-simple-websockets-chat-app
apigateway aws lambda powershell-core websockets
Last synced: about 1 month ago
JSON representation
This is a personal project created so I could learn about the websocket support in API Gateway.
- Host: GitHub
- URL: https://github.com/austoonz/powershell-core-simple-websockets-chat-app
- Owner: austoonz
- License: apache-2.0
- Created: 2019-04-14T03:39:48.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-04-14T03:55:02.000Z (over 5 years ago)
- Last Synced: 2024-10-12T21:01:49.012Z (3 months ago)
- Topics: apigateway, aws, lambda, powershell-core, websockets
- Language: PowerShell
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# PowerShell Core Port of simple-websockets-chat-app
This is a PowerShell Core port of the [simple-websockets-chat-app](https://github.com/aws-samples/simple-websockets-chat-app) sample for AWS Lambda. For more information see the [Announcing WebSocket APIs in Amazon API Gateway](https://aws.amazon.com/blogs/compute/announcing-websocket-apis-in-amazon-api-gateway/) blog post.
## Deploy
To deploy this sample, ensure you have setup a [PowerShell Core Development Environment for AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/lambda-powershell-setup-dev-environment.html).
First, execute the following PowerShell commands in the root directory of this repository. This will import the WebSocket PowerShell Module and compile the PowerShell Core AWS Lambda Function.
```powershell
Import-Module -Name 'AWSLambdaPSCore'$functionScript = [System.IO.Path]::Combine('.', 'WebSocket', 'WebSocket.ps1')
$websocketManifest = [System.IO.Path]::Combine('.', 'WebSocket', 'WebSocket.psd1')
$lambdaPackage = [System.IO.Path]::Combine('.', '_packaged', 'WebSocket.zip')Import-Module $websocketManifest
$null = New-AWSPowerShellLambdaPackage -ScriptPath $functionScript -OutputPackage $lambdaPackage
```This sample can be deployed using the [AWS Lambda .NET Core Global Tool](https://aws.amazon.com/blogs/developer/net-core-global-tools-for-aws/).
To install the global tool, execute the following command. Be sure at least version 3.1.0 of the tool is installed.
```
dotnet tool install -g Amazon.Lambda.Tools
```To upgrade the global tool, execute the following command.
```
dotnet tool update -g Amazon.Lambda.Tools
```To deploy the sample application, execute the following command in the root directory of this repository.
```
dotnet lambda deploy-serverless --template template.yaml --region --s3-bucket
```To test the WebSockets functionality, use a WebSockets client (such as the Chrome "Simple WebSocket Client" extension) to connect to the value listed in the CloudFormation "WebSocketURI" output.
To send messages to connected clients, send a JSON message formatted like this, with the value of "data" as the message to send.
```
{"action":"sendmessage", "data":"Hello World"}
```To delete the sample application, execute the following command.
```
dotnet lambda delete-serverless
```