Giter Site home page Giter Site logo

austoonz / powershell-core-simple-websockets-chat-app Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 12 KB

This is a personal project created so I could learn about the websocket support in API Gateway.

License: Apache License 2.0

PowerShell 100.00%
aws apigateway websockets powershell-core lambda

powershell-core-simple-websockets-chat-app's Introduction

PowerShell Core Port of simple-websockets-chat-app

This is a PowerShell Core port of the simple-websockets-chat-app sample for AWS Lambda. For more information see the 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.

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.

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.

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 <stack-name> --template template.yaml --region <region> --s3-bucket <storage-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 <stack-name>

powershell-core-simple-websockets-chat-app's People

Contributors

austoonz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.