[Libwebsockets] LWS_CALLBACK_HTTP send/write text only

Andy Green andy at warmcat.com
Wed Apr 8 00:32:57 CEST 2015

On 8 April 2015 01:49:01 GMT+08:00, Peter Kroon <plakroon at gmail.com> wrote:
>I'm trying to create a http server that will send some text to all
>I''ve used the code below. Only when I do Ctrl-C the webserver is
>and the text will appear on the page in the webbrowser. Any hints on
>how I
>can make this work properly?

How about it is working properly, but the browser is waiting for some legit http / html to appear befoe rendering it?  When the socket closes he gives up.

For example it should be saying "200 OK\r\n"...


>  char the_response[] = "Hello, World!";
>  int strl = strlen(the_response);
>  int n = libwebsocket_write(wsi, the_response, strl, LWS_WRITE_HTTP);
>  printf("writing hello world ?....%d\n", n);
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org

More information about the Libwebsockets mailing list