{"id":16658336,"url":"https://github.com/tuddman/socketcluster-clj","last_synced_at":"2025-10-11T01:20:42.770Z","repository":{"id":62434992,"uuid":"191857162","full_name":"tuddman/socketcluster-clj","owner":"tuddman","description":"A SocketCluster Client library for Clojure.","archived":false,"fork":false,"pushed_at":"2019-06-14T03:01:50.000Z","size":15,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-12T19:45:19.506Z","etag":null,"topics":["clojure","real-time","socketcluster","socketcluster-client"],"latest_commit_sha":null,"homepage":"https://socketcluster.io","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tuddman.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-14T01:36:58.000Z","updated_at":"2020-03-12T17:16:22.000Z","dependencies_parsed_at":"2022-11-01T21:15:53.084Z","dependency_job_id":null,"html_url":"https://github.com/tuddman/socketcluster-clj","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/tuddman/socketcluster-clj","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuddman%2Fsocketcluster-clj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuddman%2Fsocketcluster-clj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuddman%2Fsocketcluster-clj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuddman%2Fsocketcluster-clj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tuddman","download_url":"https://codeload.github.com/tuddman/socketcluster-clj/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuddman%2Fsocketcluster-clj/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005926,"owners_count":26083984,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"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":["clojure","real-time","socketcluster","socketcluster-client"],"created_at":"2024-10-12T10:05:16.704Z","updated_at":"2025-10-11T01:20:42.734Z","avatar_url":"https://github.com/tuddman.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# socketcluster-clj\n\nA [SocketCluster](https://socketcluster.io/) Client library for Clojure. This client wraps [socketcluster-client-java](https://github.com/sacOO7/socketcluster-client-java), but where appropriate aims to be more idiomatic and succinct.\n\n\n[![Clojars Project](https://img.shields.io/clojars/v/tuddman/socketcluster-clj.svg)](https://clojars.org/tuddman/socketcluster-clj)\n\n## Usage\n\n```clojure\nlein repl\n\n;; define\n=\u003e (require '[socketcluster-clj.client :as sc-client])\n=\u003e (require '[socketcluster-clj.listeners :as sc-listen])\n=\u003e (require '[socketcluster-clj.events :as sc-event])\n=\u003e (require '[socketcluster-clj.channels :as sc-ch])\n=\u003e (def sc-server-url \"ws://localhost:8000/socketcluster/\")\n=\u003e (def my-socket (sc-client/new-socket sc-server-url)  \nor\n=\u003e (sc-client/set-url my-socket sc-server-url)\n\n;; set listener(s)\n=\u003e (sc-listen/set-listener my-socket)\n\n;; connect\n=\u003e (sc-client/connect my-socket)\n;; automatically re-connect\n=\u003e (sc-client/set-reconnect-strategy my-socket 2000 30)\n\n;; send event(s) to the server\n=\u003e (sc-event/emit my-socket {\"some\" \"data\"})\n\n;; CHANNELS -\n\n;; subscribe\n\n=\u003e (sc-ch/create-channel my-socket \"channel-name\")\n=\u003e (sc-ch/set-channel-listener my-socket \"channel-name\" (fn [name data] (print \"received on channel =\u003e \" name \"some data =\u003e \" data)))\n=\u003e (sc-ch/subscribe my-socket \"channel-name\")\n\n;; publish\n=\u003e (sc-ch/publish my-socket \"channel-name\" {\"some\" \"data\"})\n```\n\nfor more, have a look in `src/socketcluster_clj/\u003cns\u003e.clj` to learn what else you can call.\n\n\n### NPE Issue\n\nif you get the following error when trying to connect:\n\n```bash\nException in thread \"OkHttp Dispatcher\" java.lang.NullPointerException\n\tat io.github.sac.Socket$1.onFailure(Socket.java:185)\n\tat okhttp3.internal.ws.RealWebSocket.failWebSocket(RealWebSocket.java:546)\n\tat okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:206)\n```\n\nyou need to `(sc-listen/set-listener \u003csocket\u003e)` **before** connecting.\n\n## License\n\nCopyright © 2019 tuddman\n\nThis program and the accompanying materials are made available under the\nterms of the Eclipse Public License 2.0 which is available at\nhttp://www.eclipse.org/legal/epl-2.0.\n\nThis Source Code may also be made available under the following Secondary\nLicenses when the conditions for such availability set forth in the Eclipse\nPublic License, v. 2.0 are satisfied: GNU General Public License as published by\nthe Free Software Foundation, either version 2 of the License, or (at your\noption) any later version, with the GNU Classpath Exception which is available\nat https://www.gnu.org/software/classpath/license.html.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuddman%2Fsocketcluster-clj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftuddman%2Fsocketcluster-clj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuddman%2Fsocketcluster-clj/lists"}