mrniko / netty-socketio

Socket.IO server implemented on Java. Realtime java framework
Apache License 2.0
6.82k stars 1.65k forks source link

null items not sent #431

Open nakulshah opened 7 years ago

nakulshah commented 7 years ago

hello, My software is using group: 'com.corundumstudio.socketio', name: 'netty-socketio', version: '1.7.7' It has a class MyClass(String word1, String word2) It calls .sendEvent("response", myClassObject); When both word1 and word2 are populated, a full json { "word1": "hello", "word2": "world" } is sent across. But if a property is null, then that property is not sent across, for example if word1=hello and word2 is not initialized. Then the json is { "word1": "hello"}

Question: Is there a way to have net-socketio send { "word1": "hello", "word2": null} ?

senderic commented 7 years ago

Why not just send an empty string if word2 is null?

nakulshah commented 7 years ago

we have two interfaces. (1) REST and (2) websocket For REST, which is already in production, we use { "word1": "hello", "word2": null} convention. So we would like to be consistent with this in our websocket offering