Links core.async channels to unix domain sockets, or socket channels in general.
Links core.async channels to unix domain sockets, or socket channels in general.
(read-onto-channel s ch & [ex-handler])
Reads EDN structures from the socket and puts them on the channel.
ch
is closed on EOF. nil
objects are ignored, since you can't
put nil
on a channel.
If an exception is thrown while reading, it's passed to ex-handler
,
which should return true
in case we should continue, or false
if we should stop reading and close ch
. The default behaviour
for ex-handler
is to treat it like an EOF.
Reads EDN structures from the socket and puts them on the channel. `ch` is closed on EOF. `nil` objects are ignored, since you can't put `nil` on a channel. If an exception is thrown while reading, it's passed to `ex-handler`, which should return `true` in case we should continue, or `false` if we should stop reading and close `ch`. The default behaviour for `ex-handler` is to treat it like an EOF.
(socket->input-stream s & [ex-handler])
Creates an input stream that will receive all bytes read from the socket channel. This uses a dedicated thread, so only useful if you don't have too many of these.
Creates an input stream that will receive all bytes read from the socket channel. This uses a dedicated thread, so only useful if you don't have too many of these.
(write sock obj)
Writes obj
to the socket as an EDN string
Writes `obj` to the socket as an EDN string
(write-from-channel ch s)
Reads objects from the channel and writes them as EDN to the socket.
The loop will stop when ch
is closed, or when an attempt to write
to s
fails because the socket has been closed.
Reads objects from the channel and writes them as EDN to the socket. The loop will stop when `ch` is closed, or when an attempt to write to `s` fails because the socket has been closed.
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 |