Fork me on GitHub
Data Structures | Macros | Typedefs | Functions
janus_websockets.c File Reference

Janus WebSockets transport plugin. More...

#include "transport.h"
#include <arpa/inet.h>
#include <net/if.h>
#include <ifaddrs.h>
#include <libwebsockets.h>
#include "../debug.h"
#include "../apierror.h"
#include "../config.h"
#include "../mutex.h"
#include "../utils.h"
Include dependency graph for janus_websockets.c:

Data Structures

struct  janus_websockets_client
 

Macros

#define JANUS_WEBSOCKETS_VERSION   1
 
#define JANUS_WEBSOCKETS_VERSION_STRING   "0.0.1"
 
#define JANUS_WEBSOCKETS_DESCRIPTION   "This transport plugin adds WebSockets support to the Janus API via libwebsockets."
 
#define JANUS_WEBSOCKETS_NAME   "JANUS WebSockets transport plugin"
 
#define JANUS_WEBSOCKETS_AUTHOR   "Meetecho s.r.l."
 
#define JANUS_WEBSOCKETS_PACKAGE   "janus.transport.websockets"
 
#define JANUS_WEBSOCKETS_ERROR_INVALID_REQUEST   411
 
#define JANUS_WEBSOCKETS_ERROR_MISSING_ELEMENT   412
 
#define JANUS_WEBSOCKETS_ERROR_INVALID_ELEMENT   413
 
#define JANUS_WEBSOCKETS_ERROR_UNKNOWN_ERROR   499
 
#define CASE_STR(name)   case name: return #name
 
#define MESSAGE_CHUNK_SIZE   2800
 

Typedefs

typedef struct janus_websockets_client janus_websockets_client
 

Functions

janus_transportcreate (void)
 
int janus_websockets_init (janus_transport_callbacks *callback, const char *config_path)
 
void janus_websockets_destroy (void)
 
int janus_websockets_get_api_compatibility (void)
 
int janus_websockets_get_version (void)
 
const char * janus_websockets_get_version_string (void)
 
const char * janus_websockets_get_description (void)
 
const char * janus_websockets_get_name (void)
 
const char * janus_websockets_get_author (void)
 
const char * janus_websockets_get_package (void)
 
gboolean janus_websockets_is_janus_api_enabled (void)
 
gboolean janus_websockets_is_admin_api_enabled (void)
 
int janus_websockets_send_message (janus_transport_session *transport, void *request_id, gboolean admin, json_t *message)
 
void janus_websockets_session_created (janus_transport_session *transport, guint64 session_id)
 
void janus_websockets_session_over (janus_transport_session *transport, guint64 session_id, gboolean timeout, gboolean claimed)
 
void janus_websockets_session_claimed (janus_transport_session *transport, guint64 session_id)
 
json_tjanus_websockets_query_transport (json_t *request)
 
void * janus_websockets_thread (void *data)
 

Detailed Description

Janus WebSockets transport plugin.

Author
Lorenzo Miniero loren.nosp@m.zo@m.nosp@m.eetec.nosp@m.ho.c.nosp@m.om
Note
When you create a session using WebSockets, a subscription to the events related to it is done automatically, so no need for an explicit request as the GET in the plain HTTP API. Closing a WebSocket will also destroy all the sessions it created.

transports

Macro Definition Documentation

◆ CASE_STR

#define CASE_STR (   name)    case name: return #name

◆ JANUS_WEBSOCKETS_AUTHOR

#define JANUS_WEBSOCKETS_AUTHOR   "Meetecho s.r.l."

◆ JANUS_WEBSOCKETS_DESCRIPTION

#define JANUS_WEBSOCKETS_DESCRIPTION   "This transport plugin adds WebSockets support to the Janus API via libwebsockets."

◆ JANUS_WEBSOCKETS_ERROR_INVALID_ELEMENT

#define JANUS_WEBSOCKETS_ERROR_INVALID_ELEMENT   413

◆ JANUS_WEBSOCKETS_ERROR_INVALID_REQUEST

#define JANUS_WEBSOCKETS_ERROR_INVALID_REQUEST   411

◆ JANUS_WEBSOCKETS_ERROR_MISSING_ELEMENT

#define JANUS_WEBSOCKETS_ERROR_MISSING_ELEMENT   412

◆ JANUS_WEBSOCKETS_ERROR_UNKNOWN_ERROR

#define JANUS_WEBSOCKETS_ERROR_UNKNOWN_ERROR   499

◆ JANUS_WEBSOCKETS_NAME

#define JANUS_WEBSOCKETS_NAME   "JANUS WebSockets transport plugin"

◆ JANUS_WEBSOCKETS_PACKAGE

#define JANUS_WEBSOCKETS_PACKAGE   "janus.transport.websockets"

◆ JANUS_WEBSOCKETS_VERSION

#define JANUS_WEBSOCKETS_VERSION   1

◆ JANUS_WEBSOCKETS_VERSION_STRING

#define JANUS_WEBSOCKETS_VERSION_STRING   "0.0.1"

◆ MESSAGE_CHUNK_SIZE

#define MESSAGE_CHUNK_SIZE   2800

Typedef Documentation

◆ janus_websockets_client

Function Documentation

◆ create()

janus_transport* create ( void  )

◆ janus_websockets_destroy()

void janus_websockets_destroy ( void  )

◆ janus_websockets_get_api_compatibility()

int janus_websockets_get_api_compatibility ( void  )

◆ janus_websockets_get_author()

const char * janus_websockets_get_author ( void  )

◆ janus_websockets_get_description()

const char * janus_websockets_get_description ( void  )

◆ janus_websockets_get_name()

const char * janus_websockets_get_name ( void  )

◆ janus_websockets_get_package()

const char * janus_websockets_get_package ( void  )

◆ janus_websockets_get_version()

int janus_websockets_get_version ( void  )

◆ janus_websockets_get_version_string()

const char * janus_websockets_get_version_string ( void  )

◆ janus_websockets_init()

int janus_websockets_init ( janus_transport_callbacks callback,
const char *  config_path 
)

◆ janus_websockets_is_admin_api_enabled()

gboolean janus_websockets_is_admin_api_enabled ( void  )

◆ janus_websockets_is_janus_api_enabled()

gboolean janus_websockets_is_janus_api_enabled ( void  )

◆ janus_websockets_query_transport()

json_t * janus_websockets_query_transport ( json_t request)

◆ janus_websockets_send_message()

int janus_websockets_send_message ( janus_transport_session transport,
void *  request_id,
gboolean  admin,
json_t message 
)

◆ janus_websockets_session_claimed()

void janus_websockets_session_claimed ( janus_transport_session transport,
guint64  session_id 
)

◆ janus_websockets_session_created()

void janus_websockets_session_created ( janus_transport_session transport,
guint64  session_id 
)

◆ janus_websockets_session_over()

void janus_websockets_session_over ( janus_transport_session transport,
guint64  session_id,
gboolean  timeout,
gboolean  claimed 
)

◆ janus_websockets_thread()

void * janus_websockets_thread ( void *  data)