[Libwebsockets] lws_write speed

Pierre Laplante laplante.p at gmail.com
Mon May 16 21:33:28 CEST 2016

In the example of the server, you are using malloc to copy the data before using lws_write as in:


out = (char )malloc(sizeof(char)(LWS_SEND_BUFFER_PRE_PADDING + len + LWS_SEND_BUFFER_POST_PADDING));
memcpy (out + LWS_SEND_BUFFER_PRE_PADDING, str, len );
n = lws_write(wsi_in, out + LWS_SEND_BUFFER_PRE_PADDING, len, LWS_WRITE_TEXT);
If the buffer is very large, this copy all the data for almost nothing here.

because of that, libwebsocket is very slow. In fact an ajax based solution is twice as fast as websocket.

Is there another way to do this ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libwebsockets.org/pipermail/libwebsockets/attachments/20160516/16893f58/attachment.html>

More information about the Libwebsockets mailing list