{"id":15800899,"url":"https://github.com/go-crzy/lambda-go-websocket","last_synced_at":"2026-04-10T21:05:21.829Z","repository":{"id":52834057,"uuid":"356993390","full_name":"go-crzy/lambda-go-websocket","owner":"go-crzy","description":"Deploy websockets in AWS API Gateway with Go/Lambda","archived":false,"fork":false,"pushed_at":"2021-04-17T08:30:19.000Z","size":112,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-02-07T00:31:53.771Z","etag":null,"topics":["apigateway","aws","go","lambda","terraform","websocket"],"latest_commit_sha":null,"homepage":"","language":"HCL","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/go-crzy.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}},"created_at":"2021-04-11T22:26:39.000Z","updated_at":"2022-05-13T17:44:15.000Z","dependencies_parsed_at":"2022-08-22T13:51:01.298Z","dependency_job_id":null,"html_url":"https://github.com/go-crzy/lambda-go-websocket","commit_stats":null,"previous_names":["carnage-sh/lambda-go-websocket"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-crzy%2Flambda-go-websocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-crzy%2Flambda-go-websocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-crzy%2Flambda-go-websocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-crzy%2Flambda-go-websocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-crzy","download_url":"https://codeload.github.com/go-crzy/lambda-go-websocket/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246540528,"owners_count":20793930,"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":["apigateway","aws","go","lambda","terraform","websocket"],"created_at":"2024-10-05T01:08:35.292Z","updated_at":"2026-04-10T21:05:21.800Z","avatar_url":"https://github.com/go-crzy.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lambda-go-websocket\n\nDeploy websockets in AWS API Gateway with Go/Lambda. Store channel data\nin a DynamoDB table and deploy with Terraform.\n\n## Overview\n\nThe schema below show the architecture of the project:\n\n![overview](./img/arch.png)\n\nIt contains the following key components:\n\n- a dynamodb database store the currently connected websockets as well as the\n  associated channels. For now there is only one test channel\n- the `Rx` section on the top is made of a lambda and an API gateway that\n  are maintaining websocket connections with users. The lamba tracks\n  connections in dynamodb\n- the `HTTP` section on the bottom is mane of a lambda and an API gateway that\n  can be used to discover connections to a channel and dispatch a message to\n  all the users.\n\n## Before you start\n\nThere are a few issues, you need to be aware of:\n\n- [x] all the name, including the api gateway, lambda and the dynamodb table\n  are more than less hardcoded. It might be a good idea to rename them \n- [x] the build is manual and must be performed before the deploy. A a result\n  run `make` to start the deploy\n- [x] you might want to change the region and your profile to connect to the\n  right region/account\n- [x] you should change the URL, Certificates, CORS to make the example fully\n  operational\n\n## Deploy\n\nDeploying the project should be pretty simple. Assuming you have Git, Go,\nTerraform and Make install, clone the project and run:\n \n```bash\nmake\n```\n\nIt should build the 2 lambda for Linux/x86_64. To deploy them and create\nall the resources, run:\n\n```bash\ncd terraform\nterraform init\nterraform apply\n```\n\n## Test\n\nThere are several ways to test this code; an easy one is to rely on `wscat`\n\n```bash\nnpm install -g wscat\n```\n\nThe `wscat` command to run should as a terraform output. It would look like\nbelow:\n\n```bash\nwscat --connect wss://xxxxxxxx.execute-api.us-east-1.amazonaws.com/staging\n```\n\nThe Websocket will echo your message. Once you've established the websocket,\nposting into the HTTP route would send a message to the websocket too:\n\n```bash\ncurl https://yyyyyyyy.execute-api.us-east-1.amazonaws.com/staging/ \\\n  -XPOST -d'message' \n```\n\n## To continue\n\nDo not hesitate to open an issue or add a PR to the repository. You can\nfreely reuse this project, thank to the [MIT LICENCE](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-crzy%2Flambda-go-websocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-crzy%2Flambda-go-websocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-crzy%2Flambda-go-websocket/lists"}