{"id":28602865,"url":"https://github.com/lucaspar/websockets-demo","last_synced_at":"2025-07-26T00:06:14.663Z","repository":{"id":256093189,"uuid":"727297624","full_name":"lucaspar/websockets-demo","owner":"lucaspar","description":"Scenarios involving websocket connections.","archived":false,"fork":false,"pushed_at":"2024-09-08T23:16:25.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-16T10:42:01.132Z","etag":null,"topics":["python-websocket","websocket-demo","websockets"],"latest_commit_sha":null,"homepage":"","language":"Python","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/lucaspar.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":"2023-12-04T15:28:27.000Z","updated_at":"2024-09-08T23:16:28.000Z","dependencies_parsed_at":"2024-09-09T00:27:31.483Z","dependency_job_id":"e4f9e988-e1bb-4632-96ff-f77267ddcfb6","html_url":"https://github.com/lucaspar/websockets-demo","commit_stats":null,"previous_names":["lucaspar/websockets-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lucaspar/websockets-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucaspar%2Fwebsockets-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucaspar%2Fwebsockets-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucaspar%2Fwebsockets-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucaspar%2Fwebsockets-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucaspar","download_url":"https://codeload.github.com/lucaspar/websockets-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucaspar%2Fwebsockets-demo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259294339,"owners_count":22835783,"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":["python-websocket","websocket-demo","websockets"],"created_at":"2025-06-11T16:12:31.032Z","updated_at":"2025-06-11T16:12:33.425Z","avatar_url":"https://github.com/lucaspar.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Websocket Demos\n\nInstall dependencies:\n\n```bash\nuv sync\n```\n\n## Increased Backpressure Demo\n\nThis demonstrates an increase in the backpressure of a websocket connection by sending messages faster than they can be processed.\n\nEventually the connection is closed with either one of these generic errors:\n\n+ A `1006` [error code](https://www.rfc-editor.org/rfc/rfc6455#section-7.4.1) on the server side (connection was closed abnormally) and the same on the client side.\n\n+ A `1011` error code (internal error). The client fails immediately after the connection is closed.\n\n## Observations\n\n### Server state / lost messages\n\nEven though the underlying TCP guarantees the delivery of the messages, that does not mean the client has a chance to process all messages received in this demo. When the connection is timed out, the client drops remaining messages in the buffer, even though they are marked as delivered.\n\n### Execution\n\n```bash\n# Start the server\nuv run server.py\n```\n\n```bash\n# Start the client\nuv run client.py\n```\n\n### Output\n\nServer\n\n```bash\n#...\n2023-12-04 10:03:37.557 | INFO     | __main__:echo:26 - Sent message #1304\n2023-12-04 10:03:37.581 | INFO     | __main__:echo:26 - Sent message #1305\n2023-12-04 10:03:37.604 | INFO     | __main__:echo:26 - Sent message #1306\n2023-12-04 10:04:05.961 | ERROR    | __main__:echo:32 - Connection with client closed:\n2023-12-04 10:04:05.961 | ERROR    | __main__:echo:33 - no close frame received or sent\n```\n\nClient\n\n```bash\n#...\n2023-12-04 10:04:15.039 | INFO     | __main__:slow_processing:16 - Received message with 9,858 chars\n2023-12-04 10:04:16.041 | INFO     | __main__:slow_processing:16 - Received message with 10,303 chars\n2023-12-04 10:04:17.042 | INFO     | __main__:slow_processing:16 - Received message with 10,370 chars\n2023-12-04 10:04:18.043 | ERROR    | __main__:slow_processing:21 - Connection with server closed:\n2023-12-04 10:04:18.044 | ERROR    | __main__:slow_processing:22 - sent 1011 (internal error) keepalive ping timeout; no close frame received\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucaspar%2Fwebsockets-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucaspar%2Fwebsockets-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucaspar%2Fwebsockets-demo/lists"}