Closed manikmagar closed 3 years ago
Correction - Client does not support all java objects but Map
works probably because of the toString implementation of Map is compliant with JSONTokenizer for JSONObject.
Only JSONObject and JSONArray is supported at the moment. However, there are plans to allow support for arbitrary json serialization libraries such as Gson or Jackson. Keep a lookout for it.
When emitting events with https://github.com/socketio/socket.io-client-java, Java objects (eg.
Map
) can be sent to server without any JSON conversion. On server side, it is converted to an instance ofJSONObject
.But when broadcasting from server, java object isn't allowed.
PacketUtils.isPacketDataValid(array)
throws error when array contains java objects. It is expecting the literal types or JSONObject/JSONArray. For consistency, should it allow broadcasting Java objects similar to client? Looking at the client's IO Parser, it is doing the same decoding as server. So it should be able to read those objects same way as server.