mpetazzoni/sse.js

Corrupt json emitted in observeSSEMessages call

MurrayFurtado opened this issue · 1 comments

In my use of this library users are creating dynamic queries against our api. We then use SSE to stream to the client where the JSON is parsed and processed. However for certain queries corrupt 'data' events are being returned. ie a truncated message is being emitted which throws an exception when JSON.parse(message.data) is called. Using curl I am able to make the same query, output to a file, and verify that a well formed message was emitted from the same api. The truncation can occurring in the middle of a variable name, not just values, implying it's not escape character related. I can only assume that the corruption is occurring either in the SSE library, or chrome. Are you aware of any limitations to SSE or your library which could cause such truncation? I don't think this is memory related as chrome doesn't blow up and subsequent processing of uncorrupt rows can continue.

This might be related to #17