[Libwebsockets] methods other than GET
"Andy Green (林安廸)"
andy at warmcat.com
Mon Apr 8 15:39:16 CEST 2013
On 08/04/13 21:33, the mail apparently from John Beuving included:
> I thin you misunderstood. I'm using these as 2 different activities. The older clients are using HTTP PUT methods
> and the newer clients are using HTTP GET + upgrade and starting a websocket connection.
> However currently the "older" method I want to use is not provided by the libwebsockets library. Therefore
> I'm thinking of extending the libwebsockets library to support POST. How can this be done and do I have to alter the lextable in parse.c
Oh you mean POST as a webserver,, not to use POST as the upgrade method.
Yes you need to look at ./lib/minilex.c, add a token like
WSI_TOKEN_POST_URI for "POST ". make it and send the result of running
minilex to parsers.c.
grep WSI_TOKEN_GET_URI and add in WSI_TOKEN_POST_URI as equally acceptable.
> Are there any alternatives to support both methods (on 1 port)
> On Apr 8, 2013, at 3:11 PM, Andy Green (林安廸) wrote:
>> On 08/04/13 21:06, the mail apparently from John Beuving included:
>>> We have an older protocol which uses a HTTP PUT method to send XML messages to a device.
>>> This device is now also being used more often in networks which re behind an internet proxy or mobile units.
>>> To allow long term communication we allow the device to upgrade the protocol to use websockets and
>>> use port 80.
>>> We want to be backward compatible and support the old protocol and the newer websockets based protocol.
>> They're two different activities, doing an HTTP PUT and starting a websocket connection.
>> You're better off trying one then the other.
>> I'd guess it's a better bet to try the websocket connection and if that doesn't work then fall back to trying the HTTP PUT action, since that should only work with improving probability over time.
>>> On Apr 8, 2013, at 3:02 PM, Andy Green (林安廸) wrote:
>>>> On 08/04/13 20:53, the mail apparently from John Beuving included:
>>>>> I would like to extend the framework of libwebsockets to allow POST and PUT HTTP methods.
>>>>> How can this be done ? Do I have to alter the lextable in parser.c ?
>>>>> What is good practice to use websockets in combination with PUT methods.
>>>> AFAIK it's not normal to do so... there are no examples of it to base "good practice" on AFAIK... I'm not sure it's actively evil either but what's the thought process that led you to arrive at the idea?
>>> Libwebsockets mailing list
>>> Libwebsockets at ml.libwebsockets.org
More information about the Libwebsockets