-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Double json encoding in SseConnection #75
Comments
The message is JSON encoded before sending over the wire. We decode it into a String here: sse/lib/client/sse_client.dart Line 126 in be426a2
Changing this behavior would be a breaking change. Note the resulting String should be singly encoded so I'm not sure what the issue is. Can you provide more details? |
It currently only allows I'm not proposing to remove the json encoding (as it would be a break change) but to change the type of |
The incoming type will have to change which is a breaking change: sse/lib/client/sse_client.dart Line 94 in be426a2
The String you get on the otherside can be decoded once again to get the obj you want. |
I would propose to introduce this breaking change. It makes using the library more difficult, especially for newcomers. I wondered also, why there are "Control Messages" like "close" to close the connection. Ideally, this is not done by the library, but by the user. Also, SSE is intended as a one way data transfer. I cannot follow these design decisions, even though they are stated in the Readme. //Edit: |
Absolutely agree. With current implementation this package is unusable. |
The type of
SseConnection.sink
isStream<String>
but then before sending (in_setUpListener
) the message is JSON encoded. The interface I try to implement expects singly encoded JSON. Could the type ofSseConnection.sink
be relaxed toStream<Object>
so any JSON-encodable object can be sent?The text was updated successfully, but these errors were encountered: