{"id":37196667,"url":"https://github.com/epikoder/nsocket","last_synced_at":"2026-01-14T22:52:49.626Z","repository":{"id":61629005,"uuid":"551584591","full_name":"epikoder/nsocket","owner":"epikoder","description":"Event driven Messaging broker using native WebSocket ","archived":false,"fork":false,"pushed_at":"2022-10-18T10:47:31.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T12:45:03.254Z","etag":null,"topics":["event","messaging","socket","websocket"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/epikoder.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}},"created_at":"2022-10-14T17:25:45.000Z","updated_at":"2024-06-20T12:45:03.255Z","dependencies_parsed_at":"2022-10-19T19:15:20.922Z","dependency_job_id":null,"html_url":"https://github.com/epikoder/nsocket","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/epikoder/nsocket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epikoder%2Fnsocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epikoder%2Fnsocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epikoder%2Fnsocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epikoder%2Fnsocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/epikoder","download_url":"https://codeload.github.com/epikoder/nsocket/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epikoder%2Fnsocket/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28437072,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T22:37:52.437Z","status":"ssl_error","status_checked_at":"2026-01-14T22:37:31.496Z","response_time":107,"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":["event","messaging","socket","websocket"],"created_at":"2026-01-14T22:52:48.507Z","updated_at":"2026-01-14T22:52:49.578Z","avatar_url":"https://github.com/epikoder.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NSocket\n\n## Messaging framework with channels [rooms]\n\nInspired by [Socket.io](https://socket.io) and [Kataras Neffos](https://github.com/kataras/neffos)\n\n### Installation\n\n```bash\ngo get github.com/epikoder/nsocket\n```\n\n### Usage\n\n```go\nevents := nsocket.Event{\n    \"/\": func(s *melody.Session, i interface{}, soc *nsocket.NSocket) {\n     fmt.Printf(\"Namespace: [Default] -- GOT: %v ---- from ----  %v\\n\", i, s.RemoteAddr())\n     if err := soc.Broadcast(\"namespace:default -- \" + fmt.Sprintf(\"%v ------\u003e %v\", i, s.RemoteAddr())); err != nil {\n      t.Error(err)\n     }\n    },\n    \"message\": func(s *melody.Session, i interface{}, soc *nsocket.NSocket) {\n     fmt.Printf(\"Namespace: [Default/Message] -- GOT: %v ---- from ----  %v\\n\", i, s.RemoteAddr())\n     if err := soc.Emit(\"namespace:message -- \"+fmt.Sprintf(\"%v ------\u003e %v\", i, s.RemoteAddr()), \"message\"); err != nil {\n      t.Error(err)\n     }\n    },\n   }\n    \nsoc := nsocket.New(nsocket.Config{\n  AuthFunc: func(r *http.Request) (ok bool) { // Optional: Add authentication : On https Websocket send cookie to the server\n   c, err := r.Cookie(\"auth\")\n   if err != nil {\n    return\n   }\n   return c.Value == authKey\n  },\n  AllowedOrigins: []string{\"localhost:3000\", \"localhost:8000\"}, //Optional: Set allowed origins if needed\n  Namespace: nsocket.Namespace{\n   nsocket.Default: events // Events functions are called when message is received from the client\n  },\n })\n\n mux := http.NewServeMux()\n mux.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n  if err := soc.Serve(w, r); err != nil {\n   panic(err)\n  }\n })\n\n fmt.Println(\"starting server on: http://localhost:8000\")\n http.ListenAndServe(\":8000\", mux) // Start websocket server\n```\n\n### Note\n\nThis library is still under development and not production ready, use with caution.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepikoder%2Fnsocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fepikoder%2Fnsocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepikoder%2Fnsocket/lists"}