title: Message does not arrive in the proper format on the server - Socket.io
body: <p>I'm rewriting an app in react-native for android native and I need to rewrite the client socket that sends a message to the server notifying that it has connected the call room.</p>
  <p>The connection goes well and the message is sent to the server, however the format that the message arrives is inappropriate for it to be read and I am not able to do it in java in the same way as it is done in react.</p>
  <p>How to convert this code to java?</p>
  <pre><code>sendFamiliarJoined = (patientId: any, familiarId: any) =&gt; {
   if (this.socket) {
    this.socket.emit(&quot;message&quot;, {
      id: 'familiarEnteredInRoom',
      patientId,
      familiarId,
    });
    }
   }
  </code></pre>
  <p>Currently in java I'm doing it like the code below but the message still doesn't arrive in the desired format</p>
  <pre><code>JsonObject jsonObject = new JsonObject();
  jsonObject.addProperty(&quot;id&quot;,&quot;familiarEnteredInRoom&quot;);
  jsonObject.addProperty(&quot;patientId&quot;, patientRepo.getPatientId());
  jsonObject.addProperty(&quot;familiarId&quot;, userRepo.getUSerId());
  
  mSocket.emit(&quot;message&quot;, &quot;id : familiarLeftRoom&quot;, jsonObject);
  </code></pre>
  <p>The desired format would be something like:</p>
  <p><a href="https://i.stack.imgur.com/lo4C7.png" rel="nofollow noreferrer">desired format</a></p>