Closed MatthewWid closed 3 years ago
Resolved by instead leaving it to the client to deserialize JSON on each newline when multiple data items are given in a single event, instead of trying to somehow concatenate buffered data on the server-end to a serializable value to send as a single data item.
Instead of serializing and JSON-ifying each and every data write, buffer all calls to the
Session#data
method into a large data buffer and then serialize that buffer once uponSession#dispatch
ing.This makes it so deserializing the data on the client-side works properly when there is more than one call to the
Session#data
method in-between event dispatches.