Liking cljdoc? Tell your friends :D

otarta.core


capture-all-packetscljs

(capture-all-packets ch xf)

Typically used with xf via packet-filter.

Typically used with xf via `packet-filter`.
raw docstring

capture-first-packetcljs

(capture-first-packet ch xf)

Typically used with xf via packet-filter.

Typically used with xf via `packet-filter`.
raw docstring

clientcljs

(client {:keys [broker-url default-root-topic] :as opts})

Accepts the following parameters:

  • broker-url (required) - url of the form ws(s)://(user:password@)host:12345/path(#some/root-topic). The root-topic is prepended to all subscribes/publishes and ensures that the client only needs to care about topics that are relevant for the application, e.g. "temperature/current" (instead of "staging/sensor0/temperature/current"). You can provide a default-topic-root.
  • default-root-topic - root-topic used when broker-url does not contain one. This e.g. allows the client-logic to subscribe to "#" knowing that it won't subscribe to the root of a broker.
  • keep-alive (default 60) - maximum seconds between pings.
  • client-id (default "otarta-<random-uuid>") - Client Identifier used to connect to broker.
Accepts the following parameters:
  - broker-url (required) - url of the form ws(s)://(user:password@)host:12345/path(#some/root-topic).
The root-topic is prepended to all subscribes/publishes and ensures that the client only needs to care about topics that are relevant for the application, e.g. "temperature/current" (instead of "staging/sensor0/temperature/current"). You can provide a default-topic-root.
  - default-root-topic - root-topic used when broker-url does not contain one. This e.g. allows the client-logic to subscribe to "#" knowing that it won't subscribe to the root of a broker.
  - keep-alive (default 60) - maximum seconds between pings.
  - client-id (default "otarta-<random-uuid>") - Client Identifier used to connect to broker.
raw docstring

connectcljs

(connect client)

Connect with broker. Idempotent. Typically there's no need to call this as it's called from publish and subscribe.

Connect with broker. Idempotent.
Typically there's no need to call this as it's called from `publish` and `subscribe`.
raw docstring

disconnectcljs

(disconnect client)
raw docstring

generate-payload-formattercljs

(generate-payload-formatter read-write format)

mqtt-connectcljs

(mqtt-connect {:keys [stream config] :as client})

mqtt-disconnectcljs

(mqtt-disconnect {stream :stream :as client})

mqtt-formatcljs

Read and write mqtt-packets

Read and write mqtt-packets
raw docstring

packet-filtercljs

(packet-filter matchers)

Yield xf that filters a packet against matchers.

Matchers come in a map, like:

  • {[:a :b] 2} match {:a {:b 2}}
  • {[:a 0 :b] 2} match {:a [{:b 2}]}
  • {[:a] 1 [:b] 3} does not match {:a 1 :b 2}
  • {[:a] nil} does not match {} (cause there's no :a)

You can provide a predicate:

  • {[:a :b] odd?} matches {:a {:b 3}}
Yield xf that filters a packet against matchers.

Matchers come in a map, like:
- {[:a :b] 2} match {:a {:b 2}}
- {[:a 0 :b] 2} match {:a [{:b 2}]}
- {[:a] 1 [:b] 3} does *not* match  {:a 1 :b 2}
- {[:a] nil} does *not* match {} (cause there's no :a)

You can provide a predicate:
- {[:a :b] odd?} matches {:a {:b 3}}
raw docstring

parse-broker-urlcljs

(parse-broker-url url)
(parse-broker-url url {:keys [default-root-topic]})

payload-formatscljs


publishcljs

(publish client topic msg)
(publish client topic msg opts)

Yields async-channel that returns [err result] when msg is published.

Currently err is always nil as no check is done whether the underlying connection is active, nor whether the broker received the message (ie qos 0).

Yields async-channel that returns [err result] when msg is published.

Currently `err` is always nil as no check is done whether the
underlying connection is active, nor whether the broker received
the message (ie qos 0).
raw docstring

send-and-await-responsecljs

(send-and-await-response pkt sink source)
(send-and-await-response pkt
                         sink
                         source
                         {:keys [max-wait] :or {max-wait 1000} :as _opts})
raw docstring

start-pingercljs

(start-pinger {stream :stream {keep-alive :keep-alive} :config :as client})

Keeps mqtt-connection alive by sending pingreq's every keep-alive seconds.

Keeps mqtt-connection alive by sending pingreq's every `keep-alive`
seconds.
raw docstring

stop-pingercljs

(stop-pinger {pinger :pinger :as client})

stream-connectcljs

(stream-connect {{url :ws-url} :config :as client})

stream-connected?cljs

(stream-connected? stream)

stream-disconnectcljs

(stream-disconnect client)

subscribecljs

(subscribe client topic-filter)
(subscribe client topic-filter opts)

Yields async-channel that returns [err result] when subscribing was successful.

err is a keyword indicating what went wrong, or nil when all is fine.
result is a map like {:chan channel}

Yields async-channel that returns [err result] when subscribing was successful.

`err` is a keyword indicating what went wrong, or nil when all is
fine.  
`result` is a map like {:chan channel}
raw docstring

tap-chcljs

(tap-ch from-ch new-ch)

topic-filter-matches-topic?cljs

(topic-filter-matches-topic? topic-filter topic)

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close