Concord - C Discord API library
A Discord API wrapper library written in C
discord_gateway Struct Reference

The handle used for interfacing with Discord's Gateway API. More...

#include <discord-internal.h>

Collaboration diagram for discord_gateway:
[legend]

Data Fields

struct logconf conf
 
struct websocketsws
 
CURLM * mhandle
 
struct {
   int64_t   hbeat_interval
 
   u64unix_ms   now
 
   u64unix_ms   hbeat_last
 
   u64unix_ms   identify_last
 
   u64unix_ms   event
 
   unsigned   hbeat_timer
 
   int   ping_ms
 
   pthread_rwlock_t   rwlock
 
} * timer
 
struct discord_identify id
 
struct discord_gateway_sessionsession
 
struct discord_gateway_payload payload
 
discord_ev_event cbs [2][DISCORD_EV_MAX]
 
discord_ev_scheduler scheduler
 

Detailed Description

The handle used for interfacing with Discord's Gateway API.

Field Documentation

◆ conf

struct logconf discord_gateway::conf

DISCORD_GATEWAY logging module

◆ ws

struct websockets* discord_gateway::ws

the websockets handle that connects to Discord

◆ mhandle

CURLM* discord_gateway::mhandle

curl_multi handle for non-blocking transfer over websockets

◆ hbeat_interval

int64_t discord_gateway::hbeat_interval

fixed milliseconds interval between heartbeats

Note
obtained at HELLO

◆ now

u64unix_ms discord_gateway::now

Gateway's concept of "now"

Note
updated at discord_gateway_perform()

◆ hbeat_last

u64unix_ms discord_gateway::hbeat_last

last heartbeat pulse timestamp

Note
first sent at READY and RESUME, then updated every hbeat_interval

◆ identify_last

u64unix_ms discord_gateway::identify_last

timestamp of last succesful identify request

Note
updated at discord_gateway_send_identify()

◆ event

u64unix_ms discord_gateway::event

timestamp of last succesful event

Note
resets every 60s

◆ hbeat_timer

unsigned discord_gateway::hbeat_timer

timer id for heartbeat timer

◆ ping_ms

int discord_gateway::ping_ms

latency obtained from HEARTBEAT and HEARTBEAT_ACK response interval

◆ rwlock

pthread_rwlock_t discord_gateway::rwlock

ping rwlock

◆ 

struct { ... } * discord_gateway::timer

timers kept for synchronization

◆ id

struct discord_identify discord_gateway::id

the identify structure for client authentication

◆ session

struct discord_gateway_session* discord_gateway::session

on-going session structure

◆ payload

struct discord_gateway_payload discord_gateway::payload

response-payload structure

◆ cbs

discord_ev_event discord_gateway::cbs[2][DISCORD_EV_MAX]

the user's callbacks for Discord events

Note
index 0 for cache callbacks, index 1 for user callbacks
Todo:
should be cast to the original callback signature before calling, otherwise its UB

◆ scheduler

discord_ev_scheduler discord_gateway::scheduler

the event scheduler callback


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