Adapter to plug a NATS
connection to a libevent
event loop.
◆ natsLibevent_Init()
void natsLibevent_Init |
( |
void |
| ) |
|
Needs to be called once so that the adapter can initialize some state.
◆ natsLibevent_Attach()
This callback is invoked after NATS
library has connected, or reconnected. For a reconnect event, *userData
will not be NULL
. This function will start polling on READ events for the given socket
.
- Parameters
-
userData | the location where the adapter stores the user object passed to the other callbacks. |
loop | the event loop as a generic pointer. Cast to appropriate type. |
nc | the connection to attach to the event loop |
socket | the socket to start polling on. |
◆ natsLibevent_Read()
natsStatus natsLibevent_Read |
( |
void * |
userData, |
|
|
bool |
add |
|
) |
| |
This callback is invoked to notify that the event library should start or stop polling for READ events.
- Parameters
-
userData | the user object created in natsLibevent_Attach |
add | true if the library needs to start polling, false otherwise. |
◆ natsLibevent_Write()
natsStatus natsLibevent_Write |
( |
void * |
userData, |
|
|
bool |
add |
|
) |
| |
This callback is invoked to notify that the event library should start or stop polling for WRITE events.
- Parameters
-
userData | the user object created in natsLibevent_Attach |
add | true if the library needs to start polling, false otherwise. |
◆ natsLibevent_Detach()
When a connection is closed (not disconnected, pending a reconnect), this callback will be invoked. This is the opportunity to cleanup the state maintained by the adapter for this connection.
- Parameters
-