#pragma once #include "../util/buffer.h" #include "curl.h" struct nn_websocket { struct nn_curl curl; struct nn_buffer frame; void (*callback)(void *, const struct curl_ws_frame *, u8 *, size_t); void *userdata; }; bool nn_websocket_init(struct nn_websocket *ws); void nn_websocket_set_url(struct nn_websocket *ws, str *url); bool nn_websocket_connect(struct nn_websocket *ws, struct nn_event_loop *loop, void (*callback)(void *, const struct curl_ws_frame *, u8 *, size_t), void *userdata); void nn_websocket_disconnect(struct nn_websocket *ws, u16 status); bool nn_websocket_send_frame(struct nn_websocket *ws, u8 *data, size_t size);