(notonline)-->
without js -- (zmq dll/so)
puts(1, "durasub:\n")
include zmq/zmq.e
atom context = zmq_init(1)
zmq_assert(context, "zmq_init")
--// connect our subscriber socket
atom subscriber = zmq_socket(context, ZMQ_SUB)
atom id = allocate_string("Hello")
zmq_setsockopt(subscriber, ZMQ_IDENTITY, id, 5)
zmq_setsockopt(subscriber, ZMQ_SUBSCRIBE, 0, 0)
zmq_connect(subscriber, "tcp://localhost:5565")
free(id)
--// synchronise with publisher
atom sync = zmq_socket(context, ZMQ_PUSH)
zmq_connect(sync, "tcp://localhost:5564")
zmq_s_send(sync, "")
--// get updates, Ctrl-C break
while true do
string s = zmq_s_recv(subscriber)
printf(1, "%s\n", {s})
if s=="END" then exit end if
end while
zmq_close(sync)
zmq_close(subscriber)
zmq_term(context)