{"id":13509007,"url":"https://github.com/alash3al/wsify","last_synced_at":"2025-04-04T14:06:21.746Z","repository":{"id":28594993,"uuid":"118753158","full_name":"alash3al/wsify","owner":"alash3al","description":"A very simple  general purpose websocket server that does the job","archived":false,"fork":false,"pushed_at":"2024-06-27T13:42:49.000Z","size":977,"stargazers_count":528,"open_issues_count":2,"forks_count":55,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-03-28T13:06:28.547Z","etag":null,"topics":["backend","go","golang","pub","pubsub","pusher","realtime","realtime-messaging","redis-channel","tiny","topic","webhook","websocket-service","websockets"],"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/alash3al.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":"2018-01-24T10:59:20.000Z","updated_at":"2025-03-06T06:15:59.000Z","dependencies_parsed_at":"2024-06-20T16:28:54.065Z","dependency_job_id":"8edb314d-4364-4753-afd9-f79148a4a935","html_url":"https://github.com/alash3al/wsify","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alash3al%2Fwsify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alash3al%2Fwsify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alash3al%2Fwsify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alash3al%2Fwsify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alash3al","download_url":"https://codeload.github.com/alash3al/wsify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190165,"owners_count":20898697,"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":["backend","go","golang","pub","pubsub","pusher","realtime","realtime-messaging","redis-channel","tiny","topic","webhook","websocket-service","websockets"],"created_at":"2024-08-01T02:01:01.672Z","updated_at":"2025-04-04T14:06:21.726Z","avatar_url":"https://github.com/alash3al.png","language":"Go","readme":"WSIFY\n======\n\u003e a tiny general purpose websocket server that could be used for building real-time apps\n\u003e in addition to giving you the power to simply accept/reject any websocket message when using the\n\u003e authorizer feature (a webhook that should respond with 200 OK on success and anything else to reject).\n\nPhilosophy\n==========\n- A websocket server should only responsible for transmitting messages in real-time between connected parties.\n- It isn't the websocket server responsibility to authorize whether a party is allowed to send certain message or not.\n- An authorizer must respond with `200 OK` if a party can send a message.\n  - `200 OK` means \"Authorized\"\n  - `5xx` means \"the authorizer is down, please close the current connection and reconnect\"\n  - anything else means \"NotAuthorized\"\n- The client identity should be declared in the query params while connecting to the websocket endpoint and as an argument in the `args` of the message if needed.\n- \n\nDefinitions\n============\n### Message\n\u003e is a data structure contains some data to be transmitted.\n\n```json5\n{\n  // command is a string describes what should be done\n  // available commands are:\n  // \"join\": joins a channel (specified in the \"args.channel\")\n  // \"leave\": leaves a channel (specified in the \"args.channel\")\n  // \"broadcast\": broadcasts a content (specified in the \"args.content\") to a channel (in \"args.channel\")\n  \"command\":  \"join\",\n  \"args\": {\n    \"channel\": \"some_channel\"\n  }\n}\n```\n\n### Authorizer\n\u003e a webhook that responds with `200 OK` to accept a message sent by a websocket client,\n\u003e the authorizer will receive a `POST` request containing a message data structure as described above, but there\n\u003e is one special command that isn't described which is \"connect\", it is fired before accepting the websocket connection\n\u003e and it sounds like \n```json5\n{\n  \"command\": \"connect\",\n  \"args\": {\n    // array of all http headers sent by the client while trying to open a websocket connection.\n    \"headers\": [/*...*/],\n    // an object that contains all available query params sent by the client while trying to open a websocket connection.\n    \"query\": {/*...*/}\n  }\n}\n```\n\nUsage\n=====\n\u003e There is no need to say a lot on how to use this software, just connect using any websocket client to `http://wsify:3000/ws` and start sending messages\n\n\nExamples\n========\n\n#### \\\u003e How can a client/device connect to the websocket service?\n\u003e by simply connecting to the following endpoint `ws://your.wsify.service:port/ws`\n\n\n#### \\\u003e What is the command used to join a channel named \"hello\"?\n\u003e\n```json\n{\n  \"command\":  \"join\",\n  \"args\": {\n    \"channel\": \"hello\"\n  }\n}\n```\n\n#### \\\u003e What is the command used to broadcast a message to the channel \"hello\"?\n```json\n{\n  \"command\":  \"broadcast\",\n  \"args\": {\n    \"channel\": \"hello\"\n  }\n}\n```\n\n#### \\\u003e How can I publish message to `hello` from another server without connecting to the websocket endpoint?\n\u003e Do a post request to `/broadcast` with the following format:\n```json5\n{\n    \"channel\": \"hello\",\n    \"args\": {\n      \"content\": \"Hello World! from the server\"\n    }\n}\n```\n\n### for more info look at `$ ./wsify --help`","funding_links":[],"categories":["Go","Repositories","backend"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falash3al%2Fwsify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falash3al%2Fwsify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falash3al%2Fwsify/lists"}