Signed-off-by: Andy Green <andy@warmcat.com>
#include <poll.h>
static unsigned int opts;
+static int was_closed;
/*
* This demo shows how to connect multiple websockets simultaneously to a
switch (reason) {
+ case LWS_CALLBACK_CLOSED:
+ fprintf(stderr, "LWS_CALLBACK_CLOSED\n");
+ was_closed = 1;
+ break;
+
case LWS_CALLBACK_CLIENT_ESTABLISHED:
/*
*/
n = 0;
- while (n >= 0)
+ while (n >= 0 && !was_closed)
n = libwebsocket_service(context, 1000);
+ fprintf(stderr, "Exiting\n");
+
libwebsocket_context_destroy(context);
return 0;