socket.io-client-java icon indicating copy to clipboard operation
socket.io-client-java copied to clipboard

Different data formats sent by `emit`

Open PavloZoria opened this issue 3 years ago • 0 comments

I compare events that we are trying to emit from the client side to the backend. After comparing these samples:

  • JS: 42["sendMessage",{"chatId":"62519549325a40c72576938d","messageText":"gh"}]
  • Android: 42["sendMessage","{"messageText":"gh","chatId":"62519549325a40c72576938d"}"] As you can see from the sample above, the parsed message from android differs from the JS one. In JS socket io puts data as an object, from the other hand android puts data as a string.

Android version of sample request caused because Socke.IO puts event and data to the JSONArray. And after parsing the JSONArray it puts all entries as a string

Can it be handled on the server-side(for example just to edit some configuration) or do we require updates from the Socket.IO library?

Thanks in advance!

PavloZoria avatar Apr 14 '22 20:04 PavloZoria