sitespeedio / chrome-har

Create HAR files from Chrome Debugging Protocol data
MIT License
150 stars 51 forks source link

Support WebSocket in HAR #113

Open germanbisogno opened 9 months ago

germanbisogno commented 9 months ago

Do you have plans to include WebSockets in the result of harFromMessages?

Since chrome 76, it includes WebSocket messages in HAR exports.

Ref: https://developer.chrome.com/blog/new-in-devtools-76#websocket

Thanks,

Awesome project!

Germán

soulgalore commented 9 months ago

Hi @germanbisogno thanks for the kind words! Do you have a Chrome trace with a websocket, I can have a look.

Thanks Peter

soulgalore commented 9 months ago

Or even better a URL with an example, then I can generate the trace myself.

germanbisogno commented 9 months ago

hi @soulgalore , thanks for the quick response, you can setup a node express and play around ws by yourself, exporting the har file from devtools manually after sending some messages to your local server, for example as this page shows https://medium.com/@PubNub/node-js-websocket-programming-examples-f6b8e15f8f85.

Thanks,

Germán

UppaJung commented 1 month ago

The har-format package has the structure needed.

For a reference implementation: https://github.com/UppaJung/hardy-har/blob/0e1ab29feb847b5078e7af87cc85c440de335ee9/src/HarEntryBuilder.ts#L779-L799

Note: you will need to add the web sockets protocol to the supportedProtocols function.