{"id":28975959,"url":"https://github.com/lordpax/sockevent","last_synced_at":"2026-05-19T07:33:14.411Z","repository":{"id":297869529,"uuid":"835952207","full_name":"LordPax/sockevent","owner":"LordPax","description":"A simple Go library for managing WebSocket connections, clients, and rooms inspired by the socket.io library.","archived":false,"fork":false,"pushed_at":"2025-11-16T01:01:14.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-16T03:05:40.296Z","etag":null,"topics":["golang","socket-io","websocket"],"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/LordPax.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-07-30T21:21:36.000Z","updated_at":"2025-11-16T01:00:27.000Z","dependencies_parsed_at":"2025-06-08T02:51:47.831Z","dependency_job_id":null,"html_url":"https://github.com/LordPax/sockevent","commit_stats":null,"previous_names":["lordpax/sockevent"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/LordPax/sockevent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LordPax%2Fsockevent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LordPax%2Fsockevent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LordPax%2Fsockevent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LordPax%2Fsockevent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LordPax","download_url":"https://codeload.github.com/LordPax/sockevent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LordPax%2Fsockevent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33206320,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-19T07:16:55.748Z","status":"ssl_error","status_checked_at":"2026-05-19T07:16:54.366Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","socket-io","websocket"],"created_at":"2025-06-24T13:15:54.978Z","updated_at":"2026-05-19T07:33:14.380Z","avatar_url":"https://github.com/LordPax.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sockevent\n\n## Description\n\nA simple Go library for managing WebSocket connections, clients, and rooms inspired by the socket.io library.\n\n## Features\n\n- WebSocket connection management\n- Customizable event system\n- Client management with data context\n- Room creation and management\n\n## Installation\n\n```bash\ngo get github.com/LordPax/sockevent\n```\n\n## Example of project\n\n- [golang-api-template](https://github.com/LordPax/golang-api-template/blob/master/websockets/websocket.go)\n\n## Quick Start\n\n```go\npackage main\n\nimport (\n    \"net/http\"\n    \"github.com/LordPax/sockevent\"\n)\n\nfunc main() {\n    ws := sockevent.GetWebsocket()\n\n    // Handle incoming messages\n    ws.On(\"message\", func(client *sockevent.Client, message any) error {\n        // Process the message\n        return client.Emit(\"response\", \"Message received!\")\n    })\n\n    // Set up HTTP handler for WebSocket\n    http.HandleFunc(\"/ws\", ws.WsHandler)\n\n    // Start the server\n    http.ListenAndServe(\":8080\", nil)\n}\n```\n\n## Detailed Features\n\n### Connection Management\n\n```go\nws := sockevent.GetWebsocket()\nws.OnConnect(func(client *sockevent.Client, w http.ResponseWriter, r *http.Request) error {\n    // Connection logic\n    return nil\n})\nws.OnDisconnect(func(client *sockevent.Client) error {\n    // Disconnection logic\n    return nil\n})\n```\n\n### Event Handling\n\n```go\nws.On(\"customEvent\", func(client *sockevent.Client, data any) error {\n    // Handle custom event\n    return nil\n})\n```\n\n### Client Manipulation\n\n```go\n// Send a message to a client\nclient.Emit(\"event\", \"Data\")\n\n// Store data for a client\nclient.Set(\"userID\", 123)\n\n// Retrieve data from a client\nuserID := client.Get(\"userID\")\n```\n\n### Room Management\n\n```go\n// Create or get a room\nroom := ws.Room(\"room-name\")\n\n// Add a client to a room\nroom.AddClient(client)\n\n// Remove a client from a room\nroom.RemoveClient(client)\n\n// Send a message to all clients in a room\nroom.Emit(\"announcement\", \"Message for everyone in the room\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flordpax%2Fsockevent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flordpax%2Fsockevent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flordpax%2Fsockevent/lists"}