Fork me on GitHub
Loading...
Searching...
No Matches
Data Fields
janus_transport_callbacks Struct Reference

Callbacks to contact the Janus core. More...

#include <transport.h>

Data Fields

void(*const incoming_request )(janus_transport *plugin, janus_transport_session *transport, void *request_id, gboolean admin, json_t *message, json_error_t *error)
 Callback to notify a new incoming request.
 
void(*const transport_gone )(janus_transport *plugin, janus_transport_session *transport)
 Callback to notify an existing transport instance went away.
 
gboolean(*const is_api_secret_needed )(janus_transport *plugin)
 Callback to check with the core if an API secret must be provided.
 
gboolean(*const is_api_secret_valid )(janus_transport *plugin, const char *apisecret)
 Callback to check with the core if a provided API secret is valid.
 
gboolean(*const is_auth_token_needed )(janus_transport *plugin)
 Callback to check with the core if an authentication token is needed.
 
gboolean(*const is_auth_token_valid )(janus_transport *plugin, const char *token)
 Callback to check with the core if a provided authentication token is valid.
 
gboolean(*const events_is_enabled )(void)
 Callback to check whether the event handlers mechanism is enabled.
 
void(*const notify_event )(janus_transport *plugin, void *transport, json_t *event)
 Callback to notify an event to the registered and subscribed event handlers.
 

Detailed Description

Callbacks to contact the Janus core.

Field Documentation

◆ events_is_enabled

gboolean(*const janus_transport_callbacks::events_is_enabled) (void)

Callback to check whether the event handlers mechanism is enabled.

Returns
TRUE if it is, FALSE if it isn't (which means notify_event should NOT be called)

◆ incoming_request

void(*const janus_transport_callbacks::incoming_request) (janus_transport *plugin, janus_transport_session *transport, void *request_id, gboolean admin, json_t *message, json_error_t *error)

Callback to notify a new incoming request.

Parameters
[in]handleThe transport session that should be associated to this client
[in]transportPointer to the transport session instance that received the event
[in]request_idOpaque pointer to a transport plugin specific value that identifies this request, so that an incoming response coming later can be matched
[in]adminWhether this is an admin API or a Janus API request
[in]messageThe message data as a Jansson json_t object

◆ is_api_secret_needed

gboolean(*const janus_transport_callbacks::is_api_secret_needed) (janus_transport *plugin)

Callback to check with the core if an API secret must be provided.

Parameters
[in]apisecretThe API secret to validate
Returns
TRUE if an API secret is needed, FALSE otherwise

◆ is_api_secret_valid

gboolean(*const janus_transport_callbacks::is_api_secret_valid) (janus_transport *plugin, const char *apisecret)

Callback to check with the core if a provided API secret is valid.

Note
This callback should only be needed when, for any reason, the transport needs to validate requests directly, as in general requests will be validated by the core itself. It is the case, for instance, of HTTP long polls to get session events, as those never pass through the core and so need to be validated by the transport plugin on its behalf.
Parameters
[in]apisecretThe API secret to validate
Returns
TRUE if the API secret is correct, FALSE otherwise

◆ is_auth_token_needed

gboolean(*const janus_transport_callbacks::is_auth_token_needed) (janus_transport *plugin)

Callback to check with the core if an authentication token is needed.

Returns
TRUE if an auth token is needed, FALSE otherwise

◆ is_auth_token_valid

gboolean(*const janus_transport_callbacks::is_auth_token_valid) (janus_transport *plugin, const char *token)

Callback to check with the core if a provided authentication token is valid.

Note
This callback should only be needed when, for any reason, the transport needs to validate requests directly, as in general requests will be validated by the core itself. It is the case, for instance, of HTTP long polls to get session events, as those never pass through the core and so need to be validated by the transport plugin on its behalf.
Parameters
[in]tokenThe auth token to validate
Returns
TRUE if the auth token is valid, FALSE otherwise

◆ notify_event

void(*const janus_transport_callbacks::notify_event) (janus_transport *plugin, void *transport, json_t *event)

Callback to notify an event to the registered and subscribed event handlers.

Note
Don't unref the event object, the core will do that for you
Parameters
[in]pluginThe transport originating the event
[in]eventThe event to notify as a Jansson json_t object

◆ transport_gone

void(*const janus_transport_callbacks::transport_gone) (janus_transport *plugin, janus_transport_session *transport)

Callback to notify an existing transport instance went away.

Note
Be careful in calling this method, as the core will assume this client is gone for good, and will tear down all sessions it originated. So, it makes sense to call it, for instance, when a WebSocket connection was lost (the user went away). Not as much if you're handling connections and their matching with clients your own way (e.g., HTTP/HTTPS connections will come and go).
Parameters
[in]handleThe transport session that went away
[in]transportPointer to the transport session instance that went away

The documentation for this struct was generated from the following file: