nats-c library usage with libuv

7 views
Skip to first unread message

Madhusudan Samantray

unread,
Jan 7, 2026, 10:34:35 AM (13 days ago) Jan 7
to nats
Hello 

I have already a libuv event loop driving a nodejs libuv client(say client A) via named pipe . I want the same to drive c-nats client as well . Do i need to use libuv adapter and write the below code 

// Indicate which loop and callbacks to use once connected.
if (s == NATS_OK)
s = natsOptions_SetEventLoop(opts, (void*)uvLoop,
natsLibuv_Attach,
natsLibuv_Read,
natsLibuv_Write,
natsLibuv_Detach);

if (s == NATS_OK)
s = natsConnection_Connect(&conn, opts);

if (s == NATS_OK)
s = natsConnection_Subscribe(&sub, conn, subj.c_str(), onMsg, NULL);

Here the uvloop is already running  . 

This way can i get all the same writes from libuv that happens to the client A ,so that it can be forwarded to nats broker ?
Reply all
Reply to author
Forward
0 new messages