[Plugin] Socket.io Client

Excellent idea on adding JSON parsing. When I bound the function, due to time constraints and simplicity I do a data->get_string() then convert to UE FString to get a message, seen here: https://github.com//socketio-client-ue4/blob/master/Source/SocketIOClient/Private/SocketIOClientComponent.cpp#L41

The base library that I integrated uses sio::message as wrapper for JSON objects. This needs to take the received message object and turn it into a JSON string so you can parse it using the blueprint utility you’re using. Off the top of my head I thought get_string() would do that, but apparently it strictly checks for ‘string’ type variables. Looking in the socket.io-client-cpp library source would be the best place to spot how.

Edit: seems the library doesn’t natively support message<->JSON conversion, but a workaround can be found here: Feature Request : Expose sio::message mapping to/from std::string · Issue #87 · socketio/socket.io-client-cpp · GitHub. To add the workaround to the plugin would require adding that function to the component implementation and just call it if we get an empty string from our regular method.

Have you tried io.sockets.emit()? This should work IMO, but it may be down to listening to the broadcast correctly.

I’ve added the two issues here: https://github.com//socketio-client-ue4/issues and this is the link to the underlying library: GitHub - socketio/socket.io-client-cpp: C++11 implementation of Socket.IO client let me know what you discover!