{"id":25650051,"url":"https://github.com/itsjunetime/ws_router","last_synced_at":"2026-06-23T10:31:55.380Z","repository":{"id":201060494,"uuid":"361497760","full_name":"itsjunetime/ws_router","owner":"itsjunetime","description":"Server-side websocket router between host/client connections","archived":false,"fork":false,"pushed_at":"2022-10-21T05:31:53.000Z","size":149,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-31T05:08:24.951Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/itsjunetime.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}},"created_at":"2021-04-25T17:45:35.000Z","updated_at":"2021-11-08T17:26:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"c5e9f5c4-a35a-48c9-bfa3-5f14466e85a4","html_url":"https://github.com/itsjunetime/ws_router","commit_stats":null,"previous_names":["itsjunetime/ws_router"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/itsjunetime/ws_router","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsjunetime%2Fws_router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsjunetime%2Fws_router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsjunetime%2Fws_router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsjunetime%2Fws_router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itsjunetime","download_url":"https://codeload.github.com/itsjunetime/ws_router/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsjunetime%2Fws_router/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34686725,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-02-23T14:37:42.061Z","updated_at":"2026-06-23T10:31:55.361Z","avatar_url":"https://github.com/itsjunetime.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"## ws_router\n\nA simple server-side websocket router. Allows for devices on different private networks to communicate directly with each other, over whatever server this is deployed on.\n\n### How it works\nFirst, you'll make an HTTP GET to `http(s)://server:port/register` with the following URL Query parameters:\n| Parameter | Type | Description |\n| - | - | - |\n| `key` | String | __Required.__ The key that websocket connections must use when trying to connect to this registration. |\n| `host_key` | String | __Required.__ The key that someone will need to use to remove this registration while users are still connected to it. |\n| `reg_type` | String | __Required.__ Must be either `hostclient` or `lobby`. If `hostclient`, all connections will need to either act as a host or a client, and each connection's messages will only be passed to connections of the other type. If `lobby`, all connections' messages will be sent to all other connections. |\n| `id_req` | String | A specific id to request with the server (e.g. if a device accidentally disconnects, it would want to reconnect with the same ID so as to not confuse the user). When running the server with the `--reject` flag, all IDs that are requested and 1. are already in use or 2. are not exactly 8 ascii digits long will be rejected. If this flag is not set and one of these two conditions is true, the server will simply generate a random ID anyways and return that instead of the requested one. |\n\nThe response from this request will be a random string (a UUID), 32 digits long (the length of this string may change in later versions of ws_router). To connect to the registration that was just created with this most recent request, you'll connect via to a websocket via `ws(s)://server:port/connect` with the following URL Query parameters:\n\n| Parameter | Required? |Type | Description |\n| - | - | - | - |\n| `id` | Yes | String | The UUID that was sent back from the registration request described in the last step.\n| `key` | Yes | String | The `key` that was sent along with the registration request for the id specified by `id`. |\n| `sock_type` | If the `reg_type` is `hostclient` | String | If the `reg_type` for the accompanying registration was `hostclient`, this must either be `host` or `client` (depending on whether the device that is trying to connect is acting as a host or a client). If the `reg_type` is `lobby`, this parameter is not necessary. |\n\nA registration is automatically removed from the internal registration store as soon as it has been connected to at least once and there are no longer any devices connected to it. It can also be manually removed (and all of its connections disconnected once they try to send another message) by sending an HTTP GET request to `http(s)://server:port/remove` with the following URL query parameters (all of which are required):\n\n| Parameter | Type | Description |\n| - | - | - |\n| `id` | String | The UUID of the registration that you would like to remove |\n| `key` | String | The key that was sent along with the registration request for the id specified by `id`. |\n| `host_key` | String | The host_key that was sent along with the registration request for the id specified by `id`. |\n\nOnce a device has been connected to a certain registration, it can keep on communicating through that connection and the registration that it is connected to, as long as the registration has not been removed.\n\nAnyone may also query for information about the registrations and connections by sending a GET request to `/stats`.\n\n### Building\nJust as with any rust program \u0026mdash;\n```sh\ngit clone https://github.com/iandwelker/ws_router.git\ncd ws_router\ncargo build --release\n```\nYour binary will be in target/release :)\n\n__To generate certificates__ to be used with this, run:\n```\nopenssl genrsa -out key.rsa 3072\nopenssl req -new -x509 -key key.rsa -out cert.pem -days 360\n```\nand fill out all the forms it asks you about. You can leave all of them blank besides the common name, which needs to have a value.\n\n### Contributing\nIf you have any questions or suggestions or features to add, feel free to file an issue or a PR!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsjunetime%2Fws_router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitsjunetime%2Fws_router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsjunetime%2Fws_router/lists"}