-enum demo_protocols {
- /* always first */
- PROTOCOL_HTTP = 0,
-
- PROTOCOL_DUMB_INCREMENT,
- PROTOCOL_LWS_MIRROR,
- PROTOCOL_LWS_STATUS,
-
- /* always last */
- DEMO_PROTOCOL_COUNT
-};
-
-/* list of supported protocols and callbacks */
-
-static struct lws_protocols protocols[] = {
- /* first protocol must always be HTTP handler */
- {"http", lws_callback_http_dummy, 0, 0},
- {
- "dumb-increment-protocol",
- callback_dumb_increment,
- sizeof(struct per_session_data__dumb_increment),
- 128, /* rx buf size must be >= permessage-deflate rx size
- * dumb-increment only sends very small packets, so we set
- * this accordingly. If your protocol will send bigger
- * things, adjust this to match */
- },
- {NULL, NULL, 0, 0} /* terminator */
-};
-
-struct lws_context *context;
-
-static void ev_timeout_cb(EV_P_ ev_timer *w, int revents)
-{
- lws_callback_on_writable_all_protocol(context,
- &protocols[PROTOCOL_DUMB_INCREMENT]);
-}
-
-static void signal_cb(EV_P_ ev_signal *w, int revents)