Chuck Swiger / Pubnub_c_core

Fork of Pubnub_c_core by Srdjan Veljkovic

Embed: (wiki syntax)

« Back to documentation index

pubnub_timers.h File Reference

pubnub_timers.h File Reference

This is the "Timer" API of the Pubnub client library. More...

Go to the source code of this file.

Functions

int pubnub_set_transaction_timeout (pubnub_t *p, int duration_ms)
 Sets the transaction timeout for the context.
int pubnub_transaction_timeout_get (pubnub_t *p)
 Returns the current transaction timeout for the context.

Detailed Description

This is the "Timer" API of the Pubnub client library.

Functions here influence the way that Pubnub client library works with lower levels (the TCP/IP stack) with respect to how much will an operation be waited upon to complete.

It is available in most platforms, but the exact way it behaves may have noticable differences. In general, the actual timeout will be _at_ _least_ as the specified by the user, but, it may actually be more.

Definition in file pubnub_timers.h.


Function Documentation

int pubnub_set_transaction_timeout ( pubnub_t p,
int  duration_ms 
)

Sets the transaction timeout for the context.

This will be used for all subsequent transactions. If a transactions is ongoing and its timeout can be changed, it will be, but if it can't, that would not be reported as an error.

Pubnub SDKs, in general, distinguish the "subscribe" timeout and other transactions, but, C-core doesn't, to save space, as most contexts are either used for subscribe or for other transactions.

If timer support is available, pubnub_init() will set a default timeout, which is configurable at compile time. So, if the default timeout is fine with you, you don't have to call this function.

Precondition:
Call this after pubnub_init() on the context
duration_ms > 0
Parameters:
pThe Context to set transaction timeout for
duration_msDuration of the timeout, in milliseconds
Returns:
0: OK, otherwise: error, timers not supported

Definition at line 8 of file pubnub_timers.cpp.

int pubnub_transaction_timeout_get ( pubnub_t p )

Returns the current transaction timeout for the context.

Precondition:
Call this after pubnub_init() on the context
Parameters:
pThe Context for which to get the transaction timeout
Returns:
Current transaction timeout, in milliseconds (should always be > 0)

Definition at line 17 of file pubnub_timers.cpp.