From 3c75202f5f4e9c1c61fead33f0f08e742d143223 Mon Sep 17 00:00:00 2001 From: cbdev Date: Thu, 20 Jun 2019 12:44:23 +0200 Subject: Implement keep-alive pings (Fixes #4) --- websocksy.c | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'websocksy.c') diff --git a/websocksy.c b/websocksy.c index c2f0631..8b37cec 100644 --- a/websocksy.c +++ b/websocksy.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "websocksy.h" #include "builtins.h" @@ -22,7 +23,6 @@ /* TODO * - TLS - * - pings * - continuation */ @@ -46,6 +46,7 @@ char* xstr_lower(char* in){ static ws_config config = { .host = NULL, .port = NULL, + .ping_interval = 30, /* Assign the built-in defaultpeer backend by default */ .backend.init = backend_defaultpeer_init, .backend.config = backend_defaultpeer_configure, @@ -205,8 +206,9 @@ static int usage(char* fn){ fprintf(stderr, "\t%s \n", fn); fprintf(stderr, "\t%s [-p ] [-l ] [-b ] [-c