(close socket)Closes the socket connection.
Closes the socket connection.
(create url {:keys [on-open on-message on-close] :as handler-map})Starts a websocket connection and returns it.
Takes the following arguments:
url => the websocket url handler-map => a hashmap containing handler functions mapping to:
- :on-open => called when opening a socket connection
- :on-message => called when recieving message on the socket
- :on-close => called when closing a socket connection
Usage:
(require '[wscljs.client :as ws] '[wscljs.format :as fmt])
(def socket (ws/create "ws://...." handler-map))
(ws/send socket data fmt/json)
Starts a websocket connection and returns it.
Takes the following arguments:
url => the websocket url
handler-map => a hashmap containing handler functions mapping to:
- :on-open => called when opening a socket connection
- :on-message => called when recieving message on the socket
- :on-close => called when closing a socket connection
Usage:
(require '[wscljs.client :as ws]
'[wscljs.format :as fmt])
(def socket (ws/create "ws://...." handler-map))
(ws/send socket data fmt/json)
(send socket data)(send socket data format)Sends data over socket in the specified format.
Sends data over socket in the specified format.
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 |