Callbacks to contact the Janus core.
More...
#include <transport.h>
|
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.
|
|
Callbacks to contact the Janus core.
◆ 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
Callback to notify a new incoming request.
- Parameters
-
[in] | handle | The transport session that should be associated to this client |
[in] | transport | Pointer to the transport session instance that received the event |
[in] | request_id | Opaque pointer to a transport plugin specific value that identifies this request, so that an incoming response coming later can be matched |
[in] | admin | Whether this is an admin API or a Janus API request |
[in] | message | The 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] | apisecret | The 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] | apisecret | The 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] | token | The 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] | plugin | The transport originating the event |
[in] | event | The event to notify as a Jansson json_t object |
◆ transport_gone
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] | handle | The transport session that went away |
[in] | transport | Pointer to the transport session instance that went away |
The documentation for this struct was generated from the following file: