Socket.io with Android and Swift

I have a communication between an iPhone and a node.js server. Here I am creating a list with keys / values ​​(Dictionary) and emitting it over socket.io connection. On the server, I can access data like a normal javascript object.

self.socket.emit("event", ["key" : value]);

      

Now I tried in Android to send the HashMap also via socket.io connection, but the server only received the string "{key = value}" and I need to convert the string to an object.

   Map<String, String> dict = new HashMap<String, String>();
   dict.put("key", "value");
   mSocket.emit("event", dict);

      

Is it possible to send a HashMap (or similar) and get it in javascript as an object like in swift?

Many thanks for your help!

+3


source to share





All Articles