Skip to content

Instantly share code, notes, and snippets.

@payden
Created December 1, 2013 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save payden/7741879 to your computer and use it in GitHub Desktop.
Save payden/7741879 to your computer and use it in GitHub Desktop.
int
onmessage(libwebsock_client_state *state, libwebsock_message *msg)
{
unsigned int count = 0;
unsigned int len = strlen(msg->payload);
libwebsock_client_state *current;
for (current = state->ctx->clients_HEAD; current != NULL; current = current->next) {
libwebsock_send_fragment(current, msg->payload, len, WS_FRAGMENT_FIN | WS_OPCODE_TEXT);
count++;
}
return count;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment