Description
Describe the bug
Sometimes socket.io client on android sends array of int[] wront. On server I receive something which looks like this:
SELL_COMPANIES_SELECTED: {"sellCIndices":"[I@50bf616","nexEvent":"PROCESS_GAME_FIELD"}
As you can see sellCIndices":"[I@50bf616" which is something I can't undertand.
Normally received data should look like this
SELL_COMPANIES_SELECTED: {"nexEvent":"PROCESS_GAME_FIELD","sellCIndices":[0]}
To Reproduce
Socket.IO server version: 4.6.1
Server
socket.on('SELL_COMPANIES_SELECTED', function(data) {
console.log("SELL_COMPANIES_SELECTED: %s", JSON.stringify(data));
console.log("sellCIndices: " + data.sellCIndices);
console.log("nexEvent: %s", data.nexEvent);
socket.to(roomId).emit('SELL_COMPANIES_SELECTED', data);
});
// ...
Socket.IO java client version: 2.1.0
Client
int[] sellCIndices = objsToIndices(currentPlayer.getOwnedProperty(), sellingCompanies);
JSONObject obj = new JSONObject();
try {
obj.put("sellCIndices", sellCIndices);
obj.put("nexEvent", nextEvent);
} catch (JSONException e) {
Gdx.app.error(STAG, e.toString());
}
socket.emit(event.toString(), obj);
Gdx.app.debug(STAG, String.format("sending SELL_COMPANIES_SELECTED: %s, next event = %s", Arrays.toString(sellCIndices), nextEvent));
Expected behavior
On my server I expect to see something like "sellCIndices":[0]. But, sometimes I see strange data like "sellCIndices":"[I@50bf616"
Platform:
- Samsung S7, Motorola edge X30
- OS: Android 8, Android 12
Additional context
This bug breaks all my application logic, it's very important to fix it or to find a workaround.