{"id":35092634,"url":"https://github.com/gabihodoroaga/http-grpc-websocket","last_synced_at":"2026-04-27T19:34:06.310Z","repository":{"id":120735419,"uuid":"522153181","full_name":"gabihodoroaga/http-grpc-websocket","owner":"gabihodoroaga","description":"How to run HTTP, gRPC, websocket all on the same port on Google Cloud Run","archived":false,"fork":false,"pushed_at":"2022-08-09T17:32:03.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-14T20:07:53.636Z","etag":null,"topics":["cloud-run","gcp","google-cloud-platform","grpc","https","websocket"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gabihodoroaga.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2022-08-07T08:09:19.000Z","updated_at":"2022-08-09T17:34:00.000Z","dependencies_parsed_at":"2024-06-19T12:10:07.341Z","dependency_job_id":null,"html_url":"https://github.com/gabihodoroaga/http-grpc-websocket","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gabihodoroaga/http-grpc-websocket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabihodoroaga%2Fhttp-grpc-websocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabihodoroaga%2Fhttp-grpc-websocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabihodoroaga%2Fhttp-grpc-websocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabihodoroaga%2Fhttp-grpc-websocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gabihodoroaga","download_url":"https://codeload.github.com/gabihodoroaga/http-grpc-websocket/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabihodoroaga%2Fhttp-grpc-websocket/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32352398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T17:12:42.749Z","status":"ssl_error","status_checked_at":"2026-04-27T17:12:41.658Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cloud-run","gcp","google-cloud-platform","grpc","https","websocket"],"created_at":"2025-12-27T14:59:47.573Z","updated_at":"2026-04-27T19:34:06.304Z","avatar_url":"https://github.com/gabihodoroaga.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# http-grpc-websocket\n\nA demo project about how you can run HTTP, gRPC and websocket in Cloud Run using\na single port. You can follow this tutorial [HTTP, gRPC, and websocket on Google Cloud Run](https://hodo.dev/posts/post-41-gcp-cloudrun-grpc-http-ws/) to find out more.\n\n## Run and test locally\n\nRun \n\n```bash\ngo run main.go\n```\n\nOn a separate terminal,\n\ntest HTTP\n\n```bash\ncurl http://localhost:8080/ping\n```\n\ntest gRPC\n\n```bash\ngo run clients/grpc/main.go\n```\n\ntest Websocket\n\n```bash\ngo run clients/ws/main.go\n```\n\n## Run and test on Cloud Run with authentication \n\nSet your variables \n\n```bash\nPROJECT_ID=$(gcloud config list project --format='value(core.project)')\nREGION=us-central1\n```\n\nCreate a service account\n\n```bash\ngcloud iam service-accounts create demo-grpc-sa \\\n  --display-name \"Demo service account for gRPC on Cloud Run\"\n```\n\nCreate a new key for this service account\n\n```bash\ngcloud iam service-accounts keys create key.json \\\n  --iam-account demo-grpc-sa@${PROJECT_ID}.iam.gserviceaccount.com\n```\n\nBuild the image\n\n```bash\ngcloud builds submit --tag gcr.io/$PROJECT_ID/grpcwebapp --project $PROJECT_ID .\n```\n\nDeploy the service \n\n```bash\ngcloud run deploy grpcwebapp \\\n--image gcr.io/$PROJECT_ID/grpcwebapp \\\n--set-env-vars=AUTH_SERVICE_ACCOUNTS=\"demo-grpc-sa@${PROJECT_ID}.iam.gserviceaccount.com\",AUTH_AUDIENCE=webapp \\\n--allow-unauthenticated \\\n--timeout=10m \\\n--project $PROJECT_ID \\\n--region $REGION\n```\n\nGet the public URL\n\n```bash\nSERVICE_URL=$(gcloud run services describe grpcwebapp --platform managed --region $REGION --format 'value(status.url)')\necho $SERVICE_URL\nSERVICE_HOST=$(echo \"$SERVICE_URL\" | awk -F/ '{print $3}')\necho $SERVICE_HOST\n```\n\ntest HTTPS\n\n```bash\ncurl -v $SERVICE_URL/ping\n```\n\ntest gRPC\n\n```bash\ngo run clients/grpc/main.go --server \"$SERVICE_HOST:443\" --key key.json --insecure=false\n```\n\ntest Websocket\n\n```bash\ngo run clients/ws/main.go --server \"wss://$SERVICE_HOST/ws\" --key key.json\n```\n\n## Generate protobuffer files.\n\n```bash\nprotoc \\\n--proto_path=grpc/proto \\\n--go_out=plugins=grpc:. \\\n./grpc/proto/*.proto\n```\n\n## References\n\nThis example was based on this post [Serving gRPC+HTTP/2 from the same Cloud Run container](https://ahmet.im/blog/grpc-http-mux-go/) \nwritten by Ahmet Alp Balkan (https://github.com/ahmetb).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabihodoroaga%2Fhttp-grpc-websocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgabihodoroaga%2Fhttp-grpc-websocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabihodoroaga%2Fhttp-grpc-websocket/lists"}