gobwas / ws

Tiny WebSocket library for Go.
MIT License
6.12k stars 376 forks source link

json decoder or unmarshaler? #177

Closed mahditakrim closed 1 year ago

mahditakrim commented 1 year ago

Is it better to use json decoder instead of unmarshal when reading binary data using 'wsutil.ReadServerBinary(conn)' ? I know decoder is better when reading HTTP requests.

cristaloleg commented 1 year ago

Depends on your goal. Both can reuse memory to achieve zero-alloc (if it's a goal).

Anyway, no big difference in most cases, pick any that looks better for you now.

mahditakrim commented 1 year ago

Thanks.