Fork me on GitHub
#dirac
<
2019-10-24
>
p-himik18:10:05

Would it be possible to support custom formatting of values received over WebSockets? E.g. I'm using https://github.com/ptaoussanis/sente that can send e.g. EDN or transit via a WS connection. Transit is more or less tolerable when sent in its verbose form (not sure how DevTools understands that it's JSON). But its packed form is rather hard to read. EDN is readable but not browseable - it's just a string since the browser has no idea how to work with it.

p-himik19:10:19

Ah, I was looking for WebSockets so didn't find it. Yeah, more or less the same. Although I'm not sure if supporting WebSockets could be handled with the same code as for regular requests since there's no content-type attached to messages. Also, the "Transit EDN" phrase confuses me a bit since tansit and EDN are different formats.

darwin19:10:08

by “transit EDN” I meant the packed form

p-himik19:10:08

I see. I'm definitely interested in that, plus regular EDN. 🙂 On a separate note - I started looking at how it would be possible to implement it in Firefox since its dev tools appear to have matured more or less to the comparable level to Chrome's DevTools. But no, they still haven't implemented the ability to create custom formatters. 😞

darwin19:10:33

They have a bug thread somewhere about it

darwin19:10:53

just briefly looked at the devtools sources, web socket data frames and normal network request previews are handled differently

darwin19:10:44

web socket frame can be either text or binary and devtools creates corresponding view for it (in case of text type, it creates JSON view), no detection of mime type or anything like that

darwin19:10:27

in network requests it tries to look at response headers or request headers and then interpret the mime type

darwin19:10:49

actually if JSON view cannot be provided, it falls back to Common.resourceTypes.WebSocket type, whatever it is

darwin19:10:44

we would have to implement a new SourceFrame.ResourceSourceFrame type and detect packed transit there