{"id":16476291,"url":"https://github.com/softprops/serverless-aws-rust-websockets","last_synced_at":"2025-03-23T11:32:59.206Z","repository":{"id":66115710,"uuid":"176283096","full_name":"softprops/serverless-aws-rust-websockets","owner":"softprops","description":"⚡🏗️ template for new aws lambda websocket serverless rust apps","archived":false,"fork":false,"pushed_at":"2020-06-02T03:38:03.000Z","size":180,"stargazers_count":29,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T12:00:01.897Z","etag":null,"topics":["aws-lambda","lambda","push","serverless","serverless-framework","websockets"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/softprops.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"softprops"}},"created_at":"2019-03-18T12:43:02.000Z","updated_at":"2024-10-25T09:16:03.000Z","dependencies_parsed_at":"2023-02-20T19:31:03.003Z","dependency_job_id":null,"html_url":"https://github.com/softprops/serverless-aws-rust-websockets","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Fserverless-aws-rust-websockets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Fserverless-aws-rust-websockets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Fserverless-aws-rust-websockets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Fserverless-aws-rust-websockets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softprops","download_url":"https://codeload.github.com/softprops/serverless-aws-rust-websockets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245097158,"owners_count":20560311,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-lambda","lambda","push","serverless","serverless-framework","websockets"],"created_at":"2024-10-11T12:41:58.862Z","updated_at":"2025-03-23T11:32:59.184Z","avatar_url":"https://github.com/softprops.png","language":"Rust","funding_links":["https://ko-fi.com/softprops"],"categories":[],"sub_categories":[],"readme":"# serverless aws websockets\n\nexploration into Rust and [serverless websockets](https://serverless.com/framework/docs/providers/aws/events/websocket/)\n\n\n## deploy\n\n```sh\n$ npm ci \u0026\u0026 npx serverless deploy\n```\n\nYou can use the `wscat` command line utility to connect and communicate with your\nserverless application.\n\n```sh\n$ npx wscat -c wss://{YOUR-API-ID}.execute-api.{YOUR-REGION}.amazonaws.com/dev\n```\n\nThis should open up an interactive repl with which you can communicate with the server\n\nYou can send messages to the server with a json payload containing an \"action\" field of \"send\" with an optional text \"message\" field\n\n```\nconnected (press CTRL+C to quit)\n\u003e {\"action\":\"send\"}\n\u003c {\"message\":\"🏓 pong\"}\n\u003e {\"action\":\"send\", \"message\":\"psst\"}\n\u003c {\"message\":\"psst\"}\n```\n\n## how it works\n\n### Traditional websocket servers\n\nA typical websocket server requires an ability to speak a binary protocol over an upgraded\nhttp protocol connection. By its nature, that requires the operational capability to maintain a\nlong lived persistant connection with many connected clients.\n\nA server with a sturdy security posture should\nalso provide a means of encrypting information passed across network connections. Secure websocket connections require additional handshake procedures which requires additional binary protocol extensions that you are responsible for.\n\n### Serverless websocket applications\n\nAPI Gateway replaces the need for you to write and operator traditional websocket servers. API Gateway exposing a tls (wss) websocket endpoint and manages persistent connections **for you** freeing you up to focus application specific details.\n\nYour application need only implement functions to be invoked to specific lifecycle events called \"routes\". A few special routes are `$connect` `$disconnect` and `$default` which represent a new client connecting, an existing client disconnecting, and an unmapped request route respectively. You are not responsible for maintaining a network connections but you _are_ responsible\nfor maintaining **connection identifiers**. Managed serverless data stores like [Dynamo DB](https://aws.amazon.com/dynamodb/) make storing this trivially simple.\n\nYou can also route based on a request pattern. By default, with Serverless framework, it's expected connected clients send the server JSON payloads containing an \"action\" field which a handler gets routed to based on its value. This example application routes on an action called \"send\".\n\n\nDoug Tangren (softprops) 2019\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftprops%2Fserverless-aws-rust-websockets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftprops%2Fserverless-aws-rust-websockets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftprops%2Fserverless-aws-rust-websockets/lists"}