{"id":17436085,"url":"https://github.com/liangsqrt/socketio-client-go","last_synced_at":"2025-08-03T16:30:43.272Z","repository":{"id":257813149,"uuid":"868423950","full_name":"liangsqrt/socketio-client-go","owner":"liangsqrt","description":"a client of socketio written by golang","archived":false,"fork":false,"pushed_at":"2024-11-18T11:35:45.000Z","size":30,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-18T12:44:13.078Z","etag":null,"topics":["client","golang","socket-io"],"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/liangsqrt.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":"2024-10-06T10:58:16.000Z","updated_at":"2024-11-18T11:27:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"1937ad35-16f5-4206-ab91-5c9a2cb3f0dd","html_url":"https://github.com/liangsqrt/socketio-client-go","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"e4676fed2583292918dbe564a57ba21a775263d6"},"previous_names":["liangsqrt/socketio-client-go"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liangsqrt%2Fsocketio-client-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liangsqrt%2Fsocketio-client-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liangsqrt%2Fsocketio-client-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liangsqrt%2Fsocketio-client-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liangsqrt","download_url":"https://codeload.github.com/liangsqrt/socketio-client-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228552378,"owners_count":17935803,"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":["client","golang","socket-io"],"created_at":"2024-10-17T10:02:08.406Z","updated_at":"2025-08-03T16:30:43.231Z","avatar_url":"https://github.com/liangsqrt.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Project Overview\n\nThis project is a Go-based implementation of a Socket.IO client. It provides functionalities to connect to a Socket.IO server, handle events, and manage the connection lifecycle.\n\n# Notice\n\n- _Notice_: i just found this still not handle graceful disconnection, and i am not going to fix it,case busy in job.\n- Bug if you have no any framework to use, you can use this.it still works well.\n\n## Features\n\n- Connect to a Socket.IO server using WebSocket transport.\n- Emit events to the server.\n- Listen for events from the server.\n- Automatic ping to keep the connection alive.\n\n## Installation\n\nTo install the necessary dependencies, run: `go get github.com/liangsqrt/socketio-client-go`\n## Usage Example\n\nBelow is a simple example of how to use the Socket.IO client in your Go project:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/liangsqrt/socketio-client-go/socketio\"\n)\n\nfunc main() {\n\n\turl := socketioclient.SocketIoUrl{\n\t\tHost:   \"127.0.0.1\",\n\t\tPort:   8080,\n\t\tSecure: false,\n\t\tQuery:  map[string]string{\"token\": \"xxxx\"},\n\t}\n\tc, err := socketioclient.Dial(\n\t\turl,\n\t\ttransport.GetDefaultWebsocketTransport(),\n\t\t\u0026socketioclient.Namespace{\n\t\t\tNamespace: \"statistic\",\n\t\t},\n\t\ttrue,\n\t)\n\tc.On(\"your_event_name\", func(c *socketioclient.Channel, args []interface{}) error {\n\t\tif len(args) \u003e 0 {\n\t\t\tprint(args)\n\t\t} else {\n\t\t\tprint(\"Unexpected argument type\")\n\t\t}\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tpayload := map[string]string{\n\t\t\"name\":      \"172.16.1.1:7890\",\n\t\t\"uuid\":      \"a1bac2b9-c320-4ea8-a7b8-7ba85a57a30d\",\n\t\t\"download\":  \"123412\",\n\t\t\"upload\":    \"12321\",\n\t\t\"start\":     \"2024-10-03 13:01:01\",\n\t\t\"end\":       \"2024-10-03 12:01:01\",\n\t\t\"device_id\": \"12\",\n\t\t\"node_id\":   \"12\",\n\t}\n\tfor i := 0; i \u003c 10; i++ {\n\t\terr = c.Emit(\"node_traffic_usage\", payload)\n\t\ttime.Sleep(time.Second * 2)\n\t}\n\n\tif err != nil {\n\t\tprint(err.Error())\n\t}\n}\n```\n    \nTODO:\n- [x] Add automatic reconnection mechanism\n- [ ] Add socket.io communication that does not rely on WebSocket, such as HTTP-based communication\n- [x] Testing\n- [ ] Handle the message lost when reconnecting\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliangsqrt%2Fsocketio-client-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliangsqrt%2Fsocketio-client-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliangsqrt%2Fsocketio-client-go/lists"}