[Libwebsockets] How to determine data type received?

"Andy Green (林安廸)" andy at warmcat.com
Fri Jan 18 03:03:41 CET 2013

On 18/01/13 07:18, the mail apparently from Gregory Junker included:
> Hi
> Is there a way to determine the type of data sent by the remote endpoint
> in the callback function? For example, if the server sends the client
> (both using libwebsockets) how can I determine whether "in" points to
> data sent with LWS_WRITE_BINARY or LWS_WRITE_TEXT (apart from putting
> that info into my data as well)?

Hi -

Good point, until now nothing cared, since everything coming out of the 
test javascript is "text".  But the client side of libwebsockets at 
least can send binary.

I introduced an api

int lws_frame_is_binary(struct libwebsocket *wsi)

so you can find out from the receive callback what the frame type you're 
dealing with is.



More information about the Libwebsockets mailing list