[Libwebsockets] How to determine data type received?
ggjunker at gmail.com
Sat Jan 19 03:13:34 CET 2013
It looks like the patch (in both client and server) only happens on a spill
(which is not necessarily going to happen all the time?) So I still don't
get the frame_is_binary flag set at all, unless I put it up into the
next-level-up LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED case. Then I get
proper detection of the frame type.
On Fri, Jan 18, 2013 at 6:05 PM, Andy Green <andy at warmcat.com> wrote:
> Hi -
> Are you checking in your client side? My patch only sets it in server side
> rx, you'll need to do the same setting action in client-parsers.c.
> Gregory Junker <ggjunker at gmail.com> wrote:
>> Hi Andy
>> It looks like the frame_is_binary member of the wsi struct is not
>> actually being set anywhere. I put breakpoints in parser.c where it looks
>> like it should be set in the code (as well as the 04-to-07 upgrade switch
>> statement, on the text and binary frame cases) and none of those are ever
>> I know the server is sending it properly because binary data I send to a
>> browser shows up as an array and not a string. It looks like the client
>> handling is not doing it properly,
>> I'll fumble around in the code and see if I can figure out why, but
>> wanted to post a note on this.
>> On Thu, Jan 17, 2013 at 6:03 PM, "Andy Green (林安廸)" <andy at warmcat.com>wrote:
>>> On 18/01/13 07:18, the mail apparently from Gregory Junker included:
>>>> 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
>>> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libwebsockets