Using mg_handler_t for iterate_over_connections()

This commit is contained in:
Sergey Lyubka committed 2014-01-17 11:45:57 +00:00
1 parent 7690f9e34b
commit 02f19fc05a
3 files changed
+12 -12

No files matched your search

+4 -2
View File
@@ -1,13 +1,15 @@
#include <string.h>
#include "mongoose.h"
extern const char *find_embedded_file(const char *, size_t *);
static void iterate_callback(struct mg_connection *c, void *param) {
static int iterate_callback(struct mg_connection *c) {
if (c->is_websocket) {
char buf[20];
int len = snprintf(buf, sizeof(buf), "%d", * (int *) param);
int len = snprintf(buf, sizeof(buf), "%d", * (int *) c->connection_param);
mg_websocket_write(c, 1, buf, len);
}
return 1;
}
// This handler is called for each incoming websocket frame, one or more