[Libwebsockets] regarding analysis of the websocket server

Andy Green andy at warmcat.com
Thu Jul 14 06:23:42 CEST 2016


On Thu, 2016-07-14 at 03:58 +0000, Suman.Patro-TRN wrote:
> Hello, 
>             I am trying to compare and contrast http long polling
> method with the websockets protocol. 
> Hence I would like to find statistical measures of some parameters
> as:
> 1. Websocket is a full duplex protocol , but how do I show that
> visually  i.e how do I show that for every client- server  there is
> one single connection  and not two half duplex  connections that  are
> simulated to make it  work as full duplex  which is the case is the
> http long polling scenario.

netstat should show it.

But if you also serve the html (and images etc) from lws, there may be
2 or more connections for a short time, depending on the client.

Because one connection may be used to send the html, and only
afterwards a script in there makes the second connection using ws.
 After 60s or less if the browser drops it, the original http keepalive
connection will timeout from being idle.

> 2. To find network traffic in both the (http long polling and
> websockets)scenarios,I consider byte length of http request- response
> headers .In http case, I find the length by mere counting the
> characters in the header, but in websockets case, the 2  bytes
> overhead that I have read about doesn't get visually seen in the
> header . Where and how do I find that?

If you're talking about ws framing, it occurs after the connection
upgraded from http to ws protocol, ie, after the headers are sent.  ws
connections start out as http for one exchange of data each way and
then if successful both side switch to use ws protocol (which is
completely unrelated to http).

Depending on who is sending what the overhead can be up to 12 bytes per
message, but it's smaller for small message lengths.

> 3. what other parameters can be used for performance  analysis?

Dunno, you have to figure out what you care about first.

-Andy

> Thanks and regards,
> Suman
> Larsen & Toubro Limited 
> 
> www.larsentoubro.com
> This Email may contain confidential or privileged information for the
> intended recipient (s). If you are not the intended recipient, please
> do not use or disseminate the information, notify the sender and
> delete it from your system.
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> http://libwebsockets.org/mailman/listinfo/libwebsockets



More information about the Libwebsockets mailing list