{"id":19211381,"url":"https://github.com/truebrain/codespaces-websocket","last_synced_at":"2025-11-14T00:03:54.216Z","repository":{"id":147275436,"uuid":"502296468","full_name":"TrueBrain/codespaces-websocket","owner":"TrueBrain","description":"Websockets on GitHub Codespaces consistently close after ~4 minutes after being established; a repository to demonstrate the issue","archived":false,"fork":false,"pushed_at":"2022-06-11T10:42:19.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-04T17:14:12.073Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/TrueBrain.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}},"created_at":"2022-06-11T08:46:56.000Z","updated_at":"2022-06-11T09:54:39.000Z","dependencies_parsed_at":"2024-04-14T20:30:33.137Z","dependency_job_id":null,"html_url":"https://github.com/TrueBrain/codespaces-websocket","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/TrueBrain%2Fcodespaces-websocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrueBrain%2Fcodespaces-websocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrueBrain%2Fcodespaces-websocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrueBrain%2Fcodespaces-websocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TrueBrain","download_url":"https://codeload.github.com/TrueBrain/codespaces-websocket/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240286517,"owners_count":19777354,"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":[],"created_at":"2024-11-09T13:42:19.191Z","updated_at":"2025-11-14T00:03:54.184Z","avatar_url":"https://github.com/TrueBrain.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub Codespaces websocket timeout\n\nWebsockets on GitHub Codespaces consistently close after ~4 minutes after being established.\n\nThis problem only seem to exist on GitHub Codespaces, and seems to be related to their webproxy.\nWhen trying alternatives to GitHub Codespaces (like Gitpod), we do not see this issue.\nWhen trying alternatives to their webproxy (like ngrok), we also do not see this issue.\n\nThe problem exists for both Private and Public ports.\nThe problem exists with regular ping/pong messages or no messages at all.\nThe problem is also very consistent: it never disconnects before the 4 minute mark, and always shortly after (sometimes on the dot, sometimes with a few seconds drift).\n\nThis all combined gives the suspicion that this is a configuration on the GitHub webproxy, to disconnect any still-open connection after 4 minutes.\nThis seems to forget the fact websockets exist in this world :)\n\nThe main issue with this disconnect is that a lot of web frameworks use a websocket during development to live-update the website, to make development a smooth experience.\nThis disconnect every ~4 minutes kinda ruins that experience, as often web frameworks do a full reload after the websocket connection is lost.\n\nThis repository is meant to make it easy to reproduce this issue for everyone with access to GitHub Codespaces.\n\n## Getting started\n\nOpen this repository in Codespaces.\n\n```bash\npython server.py\n```\n\nClick on the `Open in Browser` button that now pops up.\n\nWait ~4 minutes, and see `Connection lost!` message.\nYou can press `Retry` to retry the test, and after 4 minutes you will see the `Connection lost!` message again.\nConsistently.\nAlways.\n\n## Alternatives tried\n\n- `Gitpod`: no disconnects any after measurable time.\n- `ngrok`: no disconnects any after measurable time.\n- `nodejs` as server: no difference.\n- `Private` vs `Public` port: no difference.\n- `Firefox` and `Chrome`: no difference.\n- Ping every 1 second: no difference.\n- No communication over websocket: no difference.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruebrain%2Fcodespaces-websocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftruebrain%2Fcodespaces-websocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruebrain%2Fcodespaces-websocket/lists"}