[Libwebsockets] REST server

Chanson Shen shenchsh94 at gmail.com
Wed Jan 9 22:28:01 CET 2019


Hi Stefano,

>From my experience, in LWS_CALLBACK_FILTER_HTTP_CONNECTION or
LWS_CALLBACK_HTTP you can get the url and parse it.
LWS_CALLBACK_HTTP_BODY and LWS_CALLBACK_HTTP_BODY_COMPLETION are useful for
POST requests.

https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/http-server/minimal-http-server-form-get/minimal-http-server-form-get.c
https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/http-server/minimal-http-server-form-post/minimal-http-server-form-post.c

These two are good materials to learn.

Best,
Chanson Shen

On Wed, Jan 9, 2019 at 9:24 AM Stefano Mora <stefano.mora at newdep.com> wrote:

> Hi,
>
> I need to handle REST requests by a web server and I’m wondering if I can
> do it with the pre-existent websocket server based on libwebsockets.
>
> I think I should declare the http callback function and handle some kind
> of event.
>
> I don’t care the html files on the mount folder .. only REST.
>
>
>
> Is it correct?
>
> Where I can fine the URL to parse some path?
>
>
>
> Thanks!
>
> ---
>
> Stefano Mora / SW Engineer
> stefano.mora at newdep.com
>
> *NEWDEP S.r.l.* – SOFTWARE & ENGINEERING SERVICES
> Office: +39 0521 1756850/ Fax: +39 0521 1800611
> Via Emilio Lepido 55/A - 43123 Parma - ITALY
> Web site: www.newdep.com
>
>
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20190109/7b140809/attachment.html>


More information about the Libwebsockets mailing list