socketio / socket.io-client-java

Full-featured Socket.IO Client Library for Java, which is compatible with Socket.IO v1.0 and later.
https://socketio.github.io/socket.io-client-java/installation.html
Other
5.34k stars 977 forks source link

Unable to emit JSON object instead it is emitting Stringified Json in Client Version - 1.0.2 #762

Closed mdhanif-simformsolutions closed 4 months ago

mdhanif-simformsolutions commented 9 months ago

Describe the bug I am trying to send a json object to my server something like this :-

val jsonObject = JsonObject()
jsonObject.addProperty("domain", "test")
jsonObject.addProperty("type", "test")
jsonObject.addProperty("bearer", "test")
mSocket?.emit("subscribe", jsonObject)

But when I see the logs what it sends is :- ["subscribe","{\"domain\":\"test\",\"type\":\"test\",\"bearer\":\"test\"}"]

Instead It should be :- ["subscribe",{"domain":"test","type":"test","bearer":"test"]

Not sure why is it being strigified here ?

To Reproduce

Socket.IO server version: 2.2.0

Socket.IO java client version: 1.0.2

Expected behavior Json Object should be send as it is instead of being converted to string

Additional context In iOS it works good but seems something is missing in android

darrachequesne commented 8 months ago

Hi! Which JsonObject are you using? The one from org.json?

darrachequesne commented 4 months ago

Closed due to inactivity, please reopen if needed.