{"id":20433117,"url":"https://github.com/sivaosorg/wsconn","last_synced_at":"2026-05-14T21:33:09.796Z","repository":{"id":207734901,"uuid":"669167614","full_name":"sivaosorg/wsconn","owner":"sivaosorg","description":"Implement the WebSocket library using the Gin framework and the Gorilla WebSocket library in Go.","archived":false,"fork":false,"pushed_at":"2024-09-07T05:34:55.000Z","size":47,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-13T07:34:19.680Z","etag":null,"topics":["golang","golang-application","golang-library","golang-package","websocket","websocket-api","websocket-client","websocket-connection","websocket-endpoint","websocket-library","websocket-proxy","websocket-server"],"latest_commit_sha":null,"homepage":"https://github.com/sivaosorg/wsconn","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/sivaosorg.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-07-21T14:03:12.000Z","updated_at":"2024-09-07T05:34:58.000Z","dependencies_parsed_at":"2024-01-21T06:25:17.697Z","dependency_job_id":"317c44b4-0f1f-467b-954e-8dd96fc420d1","html_url":"https://github.com/sivaosorg/wsconn","commit_stats":null,"previous_names":["sivaosorg/wsconn"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/sivaosorg/wsconn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivaosorg%2Fwsconn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivaosorg%2Fwsconn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivaosorg%2Fwsconn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivaosorg%2Fwsconn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sivaosorg","download_url":"https://codeload.github.com/sivaosorg/wsconn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivaosorg%2Fwsconn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33044118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"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":["golang","golang-application","golang-library","golang-package","websocket","websocket-api","websocket-client","websocket-connection","websocket-endpoint","websocket-library","websocket-proxy","websocket-server"],"created_at":"2024-11-15T08:17:47.974Z","updated_at":"2026-05-14T21:33:09.778Z","avatar_url":"https://github.com/sivaosorg.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wsconn\n\n![GitHub contributors](https://img.shields.io/github/contributors/sivaosorg/gocell)\n![GitHub followers](https://img.shields.io/github/followers/sivaosorg)\n![GitHub User's stars](https://img.shields.io/github/stars/pnguyen215)\n\nImplement the WebSocket library using the Gin framework and the Gorilla WebSocket library in Go.\n\n## Table of Contents\n\n- [wsconn](#wsconn)\n  - [Table of Contents](#table-of-contents)\n  - [Introduction](#introduction)\n  - [Features](#features)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n  - [Modules](#modules)\n    - [Running Tests](#running-tests)\n    - [Tidying up Modules](#tidying-up-modules)\n    - [Upgrading Dependencies](#upgrading-dependencies)\n    - [Cleaning Dependency Cache](#cleaning-dependency-cache)\n  - [Usage](#usage)\n    - [WebSocket Connection](#websocket-connection)\n    - [Registering Topics](#registering-topics)\n\n## Introduction\n\nThis repository provides a simple WebSocket implementation using the Gin framework and Gorilla WebSocket library in Go. It allows real-time communication between clients and a server through WebSocket connections.\n\n## Features\n\n- Topic-based Subscription: Clients can subscribe to specific topics, and the server will broadcast messages to all subscribers of that topic.\n- Dynamic Topic Registration: Topics can be dynamically registered by clients, allowing for flexible and dynamic communication channels.\n- Concurrency Handling: The implementation uses Gorilla WebSocket and supports concurrent connections and message broadcasting.\n- Closure Handling: Optionally, the server can be configured to handle closure events, such as detecting when a client connection is closed.\n\n## Prerequisites\n\nGolang version v1.20\n\n## Installation\n\n- Latest version\n\n```bash\ngo get -u github.com/sivaosorg/wsconn@latest\n```\n\n- Use a specific version (tag)\n\n```bash\ngo get github.com/sivaosorg/wsconn@v1.0.6\n```\n\n## Modules\n\nExplain how users can interact with the various modules.\n\n### Running Tests\n\nTo run tests for all modules, use the following command:\n\n```bash\nmake test\n```\n\n### Tidying up Modules\n\nTo tidy up the project's Go modules, use the following command:\n\n```bash\nmake tidy\n```\n\n### Upgrading Dependencies\n\nTo upgrade project dependencies, use the following command:\n\n```bash\nmake deps-upgrade\n```\n\n### Cleaning Dependency Cache\n\nTo clean the Go module cache, use the following command:\n\n```bash\nmake deps-clean-cache\n```\n\n## Usage\n\n### WebSocket Connection\n\nConnect to the WebSocket server using a WebSocket client. For example, in a browser, you can use JavaScript or tools like WebSocket.org's WebSocket Tester.\n\n```javascript\nconst socket = new WebSocket(\"ws://localhost:8080/subscribe\");\n\n// Handle connection open event\nsocket.addEventListener(\"open\", (event) =\u003e {\n  console.log(\"WebSocket connection opened:\", event);\n\n  // Subscribe to a topic\n  const subscription = {\n    topic: \"your-topic-name\",\n    content: \"sample\",\n    userId: \"user123\",\n    isPersistent: true,\n    // Add any additional subscription parameters as needed\n  };\n\n  socket.send(JSON.stringify(subscription));\n});\n\n// Handle incoming messages\nsocket.addEventListener(\"message\", (event) =\u003e {\n  const message = JSON.parse(event.data);\n  console.log(\"Received message:\", message);\n});\n\n// Handle connection close event\nsocket.addEventListener(\"close\", (event) =\u003e {\n  console.log(\"WebSocket connection closed:\", event);\n});\n\n// Handle connection error event\nsocket.addEventListener(\"error\", (event) =\u003e {\n  console.error(\"WebSocket error:\", event);\n});\n```\n\n### Registering Topics\n\nYou can dynamically register topics using a RESTful API endpoint:\n\n```bash\ncurl -X POST http://localhost:8080/register -d '{\"topic\": \"your-topic\"}'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsivaosorg%2Fwsconn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsivaosorg%2Fwsconn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsivaosorg%2Fwsconn/lists"}