mint_web_socket icon indicating copy to clipboard operation
mint_web_socket copied to clipboard

Question about iolists

Open ckampfe opened this issue 1 year ago • 3 comments

Hey all, thanks for the library. I don't have an issue to report, just a question.

I see that the signature of encode, specifically for a {:binary, data} payload requires that data be a binary, via the is_binary guard in the is_friendly_frame guard: https://github.com/elixir-mint/mint_web_socket/blob/main/lib/mint/web_socket/frame.ex#L67

Is this requirement for the data to be strictly a binary rather than iodata broadly due to something in the websocket protocol itself? I don't know the inner workings of the websocket protocol and I'm accustomed to using iolists via gentcp, etc., for performance, so I'm just curious if it would ever be possible to send an iolist in this library (or any others).

Thank you!

ckampfe avatar Dec 14 '23 17:12 ckampfe