Hello all,
I'm very new to the details of HAR files, and I couldn't find anything about Web Sockets so far. So, here we go.
For work I recently had to implement the W3C Web Sockets specs.
Studying the actual protocol specs (
http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-17#section-5) it's clear the Web Sockets set themselves too much a part respect to HTTP transactions to be "traced" as such.
So, I started taking a look at where in the specs format the communication of Web Sockets could fit.
First, the Handshake - well, the WS handshake it's a standard HTTP 101. It's almost always composed of a single HTTP req/res pair, where the Client asks for a WebSocket, the Server accepts (or refuses), and a set of "special" headers are used in the Handshake (most important: the "Update" one).
After that is done, there is no more HTTP going up and down: the socket on which it's based stays open and messages (chunked in frames) are sent up and down.
Second, the Messages - The official protocol defines the internal of the framing, but what we really care about is the Message. The message is a chunk of bytes or text that is sent or received, full duplex over the socket established during the Handshake.
Sending and Receiving are completely independent, asynchronous and decoupled. In other words, it's not like "http entries" in the HAR file: a message doesn't have a request AND a response.
What I'm thinking to do - The Handshaking of Web Socket it will be described by an "entry" in the current HAR format. The fact that is the "handshaking of a WebSocket" will be captured by the "headers" so, it's a no-op (good!).
The issue is that the messages will probably need their own, new "property" in the JSON of the HAR. I was thinking something like:
... "pages" : [...], "messages": [ { "comment": "", //< optional "socketref": "0123456789", //< ID of the web socket "direction": "out", //< could be "in" or "out" "pageref": "page_0", //< optional, if it was done in a web page "timings": { "receive": -1, //< -1 if direction is "out" "send": 10, //< -1 if the direction is "in" }, "type": "text", //< caould be "text", "binary" or "closing" "content": { "size": 33, "text": "\n", //< optional "comment": "" //< optional } } ], "entries" : [...], ...What's your opinion?
Would this be a good starting point?
I hope to gather some feedback from this group: as far as I understand, this is where the HAR format is discussed.
Right?
Ivan