Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add void *user_data field to _wsclient structure. #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions wsclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ typedef struct _wsclient {
wsclient_frame *current_frame;
struct sockaddr_un helper_sa;
int helper_sock;
void *user_data;
#ifdef HAVE_LIBSSL
SSL_CTX *ssl_ctx;
SSL *ssl;
Expand Down Expand Up @@ -137,6 +138,12 @@ void libwsclient_close(wsclient *c);
int libwsclient_helper_socket(wsclient *c, const char *path);
void *libwsclient_helper_socket_thread(void *ptr);

void libwsclient_onclose(wsclient *client, int (*cb)(wsclient *c));
void libwsclient_onopen(wsclient *client, int (*cb)(wsclient *c));
void libwsclient_onmessage(wsclient *client, int (*cb)(wsclient *c, wsclient_message *msg));
void libwsclient_onerror(wsclient *client, int (*cb)(wsclient *c, wsclient_error *err));
int libwsclient_send(wsclient *client, char *strdata);

//Define errors
char *errors[] = {
"Unknown error occured",
Expand Down