lib/discord-c.c
void *heartbeatFunction(void *websocket)
{
	client_websocket_t *myWebSocket = (client_websocket_t*)websocket;

	while (1)
	{
		// Wait heartbeat interval seconds; TODO make this not hard-coded
		usleep(41250*1000);

		fprintf(stderr, "Sending heartbeat...\n");
		// Create an operation 1 (=heartbeat) packet and send it off
		char packet[128];
		sprintf(packet, "{\"op\": 1, \"d\": %i}", sequenceNumber);
		websocket_send(myWebSocket, packet, strlen(packet), 0);
	}
}
// Function that keeps repeatively sending a heartbeat
Function that keeps repeatively sending a heartbeat
Function that keeps repeatively sending a heartbeat
void *heartbeatFunction(void *websocket)
{
	client_websocket_t *myWebSocket = (client_websocket_t*)websocket;
	while (1)
	{
		usleep(41250*1000);
		fprintf(stderr, "Sending heartbeat...\n");
		char packet[128];
		sprintf(packet, "{\"op\": 1, \"d\": %i}", sequenceNumber);
		websocket_send(myWebSocket, packet, strlen(packet), 0);
	}
}
void * heartbeatFunction ( void * websocket ) { client_websocket_t * myWebSocket = ( client_websocket_t * ) websocket ; while ( 1 ) { usleep ( 41250 * 1000 ) ; fprintf ( stderr , " \n " ) ; char packet [ 128 ] ; sprintf ( packet , " \" \" \" \" " , sequenceNumber ) ; websocket_send ( myWebSocket , packet , strlen ( packet ) , 0 ) ; } }
Function that keeps repeatively sending a heartbeat
Function that keeps repeatively sending a heartbeat
// Wait heartbeat interval seconds; TODO make this not hard-coded // Create an operation 1 (=heartbeat) packet and send it off