[Libwebsockets] http server help

Puja Gupta pmgupta.akl at gmail.com
Fri Jul 3 23:53:14 CEST 2020


Thanks Andy for quick response. Yes I want both server and client
side. Your server reference code helped me what I was looking for.
Basically I was confused on how to have different protocols but your
pointer helped for the url can be extracted. Thanks again, I will try
out my code now.

Best,
Puja
On Fri, Jul 3, 2020 at 12:00 PM <andy at warmcat.com> wrote:
>
>
>
> On July 3, 2020 6:51:12 PM UTC, Puja Gupta <pmgupta.akl at gmail.com> wrote:
> >Hi,
> >
> >I am newbie to web programming so pardon if my questions are stupid. I
>
> So far so good.
>
> >studied libwebsockets code and have some idea for setting up http
> >server/client. Now what I am looking to achieve is something like
> >this.
> >Be able to support multiple URLs like 'http://localhost:7681/abc' and
> >'http://localhost:7681/xyz' which have different callbacks registered
> >for each url above. From the client side I should be able to invoke
> >either of those urls based on user input. Note that all this is going
> >to be command line and no UI/html required.
> >Any pointers to how to do this or reference code will be greatly
> >appreciated.
>
> You want to make the client and the server side?  They are two different chunks of code.
> This example shows how to serve dynamic responses over http/s
>
> https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/http-server/minimal-http-server-dynamic
>
> You can find the url and respond differently just using the one protocol callback.
>
> This example shows how to get the data from http client connections.
>
> https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/http-client/minimal-http-client
>
> You'll get a quicker and better result from playing with those examples until how they work more or less makes sense, then starting your app by basically cutting and pasting those examples and modifying them.
>
> -Andy
>
> >Thanks a lot,
> >Puja
> >_______________________________________________
> >Libwebsockets mailing list
> >Libwebsockets at ml.libwebsockets.org
> >https://libwebsockets.org/mailman/listinfo/libwebsockets


More information about the Libwebsockets mailing list