Idiomatic Clojure SDK for Rockbox.
(require '[rockbox.core :as rb]
'[rockbox.playback :as pb]
'[rockbox.library :as lib])
(def client (rb/client))
;; Optional: open the WebSocket for real-time events
(rb/connect client)
(rb/on client :track-changed
(fn [t] (println "▶" (:title t) "—" (:artist t))))
;; Look at what's playing
(when-let [t (pb/current-track client)]
(println (:title t)))
;; Pipe-friendly: actions return the client so they compose
(-> client
(pb/pause)
(pb/seek 90000)
(pb/resume))
| Domain | Namespace |
|---|---|
| Transport controls | rockbox.playback |
| Library / search | rockbox.library |
| Live queue | rockbox.playlist |
| Saved playlists | rockbox.saved-playlists |
| Smart playlists | rockbox.smart-playlists |
| Volume | rockbox.sound |
| Settings | rockbox.settings |
| System info | rockbox.system |
| Filesystem browser | rockbox.browse |
| Output devices | rockbox.devices |
| Bluetooth (Linux) | rockbox.bluetooth |
| Real-time events | rockbox.events |
| Plugin system | rockbox.plugin |
| Enums and helpers | rockbox.types |
Idiomatic Clojure SDK for [Rockbox](https://www.rockbox.org).
## Quick start
(require '[rockbox.core :as rb]
'[rockbox.playback :as pb]
'[rockbox.library :as lib])
(def client (rb/client))
;; Optional: open the WebSocket for real-time events
(rb/connect client)
(rb/on client :track-changed
(fn [t] (println "▶" (:title t) "—" (:artist t))))
;; Look at what's playing
(when-let [t (pb/current-track client)]
(println (:title t)))
;; Pipe-friendly: actions return the client so they compose
(-> client
(pb/pause)
(pb/seek 90000)
(pb/resume))
## Module map
| Domain | Namespace |
|-----------------------|----------------------------|
| Transport controls | `rockbox.playback` |
| Library / search | `rockbox.library` |
| Live queue | `rockbox.playlist` |
| Saved playlists | `rockbox.saved-playlists` |
| Smart playlists | `rockbox.smart-playlists` |
| Volume | `rockbox.sound` |
| Settings | `rockbox.settings` |
| System info | `rockbox.system` |
| Filesystem browser | `rockbox.browse` |
| Output devices | `rockbox.devices` |
| Bluetooth (Linux) | `rockbox.bluetooth` |
| Real-time events | `rockbox.events` |
| Plugin system | `rockbox.plugin` |
| Enums and helpers | `rockbox.types` |(client)(client {:keys [host port http-url ws-url timeout-ms headers http-client]})Build a Rockbox client.
Options (all optional):
:host hostname or IP of rockboxd (default "localhost") :port GraphQL HTTP/WS port (default 6062) :http-url full HTTP URL override (overrides host/port) :ws-url full WebSocket URL override (overrides host/port) :timeout-ms request timeout in milliseconds (default 15000) :headers map of extra HTTP headers :http-client java.net.http.HttpClient instance to reuse
The returned value is a plain map — passable to all rockbox.* functions
as their first argument so calls compose with ->.
(def c (rb/client))
(def c (rb/client {:host "music.home" :port 6062}))
(def c (rb/client {:http-url "https://music.home/graphql"}))
Build a Rockbox client.
Options (all optional):
:host hostname or IP of rockboxd (default "localhost")
:port GraphQL HTTP/WS port (default 6062)
:http-url full HTTP URL override (overrides host/port)
:ws-url full WebSocket URL override (overrides host/port)
:timeout-ms request timeout in milliseconds (default 15000)
:headers map of extra HTTP headers
:http-client java.net.http.HttpClient instance to reuse
The returned value is a plain map — passable to all `rockbox.*` functions
as their first argument so calls compose with `->`.
(def c (rb/client))
(def c (rb/client {:host "music.home" :port 6062}))
(def c (rb/client {:http-url "https://music.home/graphql"}))(connect client)Open the WebSocket and start the three default subscriptions (track / status / playlist). Idempotent. Returns the client.
Open the WebSocket and start the three default subscriptions (track / status / playlist). Idempotent. Returns the client.
(disconnect client)Close the WebSocket connection. Returns the client.
Close the WebSocket connection. Returns the client.
(installed-plugins client)List installed plugins.
List installed plugins.
(query client gql)(query client gql vars)Execute a raw GraphQL query/mutation. Returns the kebabized data map.
Use this for operations not yet covered by the SDK.
(rb/query client "query { rockboxVersion }")
;=> {:rockbox-version "1.0.0"}
(rb/query client
"query Album($id: String!) { album(id: $id) { id title } }"
{:id "abc-123"})
Execute a raw GraphQL query/mutation. Returns the kebabized `data` map.
Use this for operations not yet covered by the SDK.
(rb/query client "query { rockboxVersion }")
;=> {:rockbox-version "1.0.0"}
(rb/query client
"query Album($id: String!) { album(id: $id) { id title } }"
{:id "abc-123"})(unuse-plugin client plugin-name)Uninstall a plugin by name. Returns the client.
Uninstall a plugin by name. Returns the client.
(use-plugin client plugin)Install a plugin. See rockbox.plugin. Returns the client.
Install a plugin. See `rockbox.plugin`. Returns the client.
(with-headers c h)Merge extra headers into c. Pipe-friendly.
Merge extra headers into `c`. Pipe-friendly.
(with-host c h)Return c with :host set to h (and URLs rebuilt). Pipe-friendly.
Return `c` with `:host` set to `h` (and URLs rebuilt). Pipe-friendly.
(with-timeout c ms)Return c with :timeout-ms set. Pipe-friendly.
Return `c` with `:timeout-ms` set. Pipe-friendly.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |