{"id":22915236,"url":"https://github.com/agustinsrg/hls-websocket-cdn","last_synced_at":"2025-07-07T12:10:22.165Z","repository":{"id":266830999,"uuid":"889539227","full_name":"AgustinSRG/hls-websocket-cdn","owner":"AgustinSRG","description":"Simple CDN (Content delivery network) to deliver HLS (HTTP Live Streaming) video streams using websocket connections.","archived":false,"fork":false,"pushed_at":"2025-03-22T11:43:48.000Z","size":706,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-13T16:18:06.149Z","etag":null,"topics":["cdn","hls","live","streaming","video","websocket"],"latest_commit_sha":null,"homepage":"","language":"Go","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/AgustinSRG.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,"zenodo":null}},"created_at":"2024-11-16T15:32:08.000Z","updated_at":"2025-03-29T09:03:03.000Z","dependencies_parsed_at":"2025-05-12T13:46:01.570Z","dependency_job_id":null,"html_url":"https://github.com/AgustinSRG/hls-websocket-cdn","commit_stats":null,"previous_names":["agustinsrg/hls-websocket-cdn"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/AgustinSRG/hls-websocket-cdn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgustinSRG%2Fhls-websocket-cdn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgustinSRG%2Fhls-websocket-cdn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgustinSRG%2Fhls-websocket-cdn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgustinSRG%2Fhls-websocket-cdn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AgustinSRG","download_url":"https://codeload.github.com/AgustinSRG/hls-websocket-cdn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgustinSRG%2Fhls-websocket-cdn/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264075705,"owners_count":23553512,"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":["cdn","hls","live","streaming","video","websocket"],"created_at":"2024-12-14T05:19:38.772Z","updated_at":"2025-07-07T12:10:17.157Z","avatar_url":"https://github.com/AgustinSRG.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HLS Websocket CDN\n\nThis project is a simple CDN (Content delivery network) to deliver HLS (HTTP Live Streaming) video streams using websocket connections, with the purpose of reducing the delay as much as possible and keeping the system scalable.\n\nThe project incudes the following components:\n\n - [Server](./server/README.md) - The main backend component of the CDN, implemented in the [Go](https://go.dev/) programming language.\n - [JavaScript client](./client-js/README.md) - A JavaScript client for browsers to be able to receive the streams.\n - [Publisher client library](./client-publisher/README.md) - A library to publish to the CDN, implemented in the [Go](https://go.dev/) programming language.\n - [Tester](./tester/README.md) - Test program to publish video files in loop and spectate from a browser.\n\n## Installation\n\nTo use the project, the best method is to run the server with Docker. \n\nYou can find the docker image for this project available in Docker Hub: https://hub.docker.com/r/asanrom/hls-websocket-cdn\n\nTo pull it type:\n\n```sh\ndocker pull asanrom/hls-websocket-cdn\n```\n\nMake sure to read the [image overview](https://hub.docker.com/r/asanrom/hls-websocket-cdn) to know about all the configuration options.\n\nYou can also compile the server yourself. In order to do that, read the [server compilation instructions](./server/README.md#compilation).\n\n## Design\n\nThe CDN is composed by servers. Servers allow both pushing and pulling HLS streams via websocket.\n\nIf you have a single server, the architecture is the simplest: The server will relay the HLS fragments from the publisher to the spectators.\n\n![Single server architecture](./documentation/single-server.drawio.png)\n\nThe most frequent case is having multiple servers. In this case, a publish registry database ([Redis](https://redis.io) or equivalent) is required for the servers to share information about what server is the one where a stream is being published.\n\n![Multi server architecture](./documentation/multi-server.drawio.png)\n\nWhen receiving a pull request, the server will try to find the stream from 3 different sources, in this order:\n\n - First, if publishing is enabled for the server, it will try finding the stream internally. It it finds it, it will relay the fragments without connecting to any other servers.\n - Second, if enabled, it will ask the Redis database to figure out what server is the one being used to publish the stream. If found, the server will connect to the publishing server and relay the fragments received from it.\n - Third, if enabled, it will connect to another server and relay the fragments from it.\n\nThe 3 methods can be individually enabled or disabled. This allows you to customize your CDN architecture.\n\nExample: You can separate the servers used to publish from the servers used to receive the stream using gateways for each region.\n\n![Custom server architecture](./documentation/custom.drawio.png)\n\n## Documentation\n\n - [Server configuration options](./server/README.md#configuration)\n - [Websocket protocol documentation](./documentation/websocket-protocol.md)\n - [Authentication mechanism documentation](./documentation/authentication.md)\n\n## License\n\nThis project is under the [MIT License](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagustinsrg%2Fhls-websocket-cdn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagustinsrg%2Fhls-websocket-cdn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagustinsrg%2Fhls-websocket-cdn/lists"}