Description Usage Arguments Details Value Author(s) Examples
zmqc
creates a 0MQ PUB/SUB connection. Modes beginning with
"w" and "a" are equivalent and create a PUB connection while modes
beginning with "r" create a SUB connection.
1 |
endpoint |
string defining the 0MQ endpoint of the connection
consisting of |
mode |
see Modes section in connections documentation and below. |
mode
set to "r"
or "rb"
opens a SUB connection
and it is read-only by design. mode
set to "w"
or
"wb"
creates a PUB connection which is write-only by
design. The modes "a"
and "ab"
are equivalent to
"w"
and "wb"
respectively. No other modes are
supported.
zmqc connection
Simon Urbanek
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | pub <- zmqc("ipc:///tmp/0mq.sock", "w")
sub <- zmqc("ipc:///tmp/0mq.sock", "r")
## subscriptions make take a bit to setup so
## we add a small delay to make sure the subscriber
## is ready
Sys.sleep(1)
writeLines("hello, world!", pub)
writeLines("I'm publishing ...", pub)
readLines(sub, 1)
close(sub)
close(pub)
## clean up the socket since we won't be re-using it
## if you plan to re-use the socket, it is actually
## possble to keep it to allow subscriptions before
## the publisher is started
unlink("/tmp/0mq.sock")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.