Announcement

Collapse
No announcement yet.

[Plugin] Socket.io Client

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Hey there,

    I´m trying to store some profilepictures with a nodejs socket.io server into a mongodb database.
    I tried a lot of stuff but unfortunately I can´t get it workin'.

    I attached 3 screenshots.
    One from inside of UE,
    one of the saved "<Binary Data>" inside the mongo db database..
    and the last one shows the "<Binary Data>" printed from the nodejs server after getting it from the datatable..
    But when I get the binary data within unreal it´s emtpy.. Is this any known bug? - or am I doing anything wrong?

    Thanks in advance for any help <3!

    Comment


      Originally posted by Mad_Toni View Post
      Hey there,

      I´m trying to store some profilepictures with a nodejs socket.io server into a mongodb database.
      I tried a lot of stuff but unfortunately I can´t get it workin'.

      I attached 3 screenshots.
      One from inside of UE,
      one of the saved "<Binary Data>" inside the mongo db database..
      and the last one shows the "<Binary Data>" printed from the nodejs server after getting it from the datatable..
      But when I get the binary data within unreal it´s emtpy.. Is this any known bug? - or am I doing anything wrong?

      Thanks in advance for any help <3!
      I just checked the latest version of the plugin against a binary roundtrip test and it still works as expected. I don't see your node.js logic in the pictures, without that I can only make assumptions. It looks like you're trying to get the field 'avatar' when your json has the binary data under 'useravatar' so it could be getting the wrong field which is why it would be empty... Otherwise the blueprints look correct at a glance. You might consider using emitWithCallback if you're trying to fetch some information from the server which would obviate the need to bind and emit another event for receiving the data.
      Plugins: Node.js - TensorFlow - Socket.io Client - ZipUtility - Leap Motion - Hydra - Myo - RealSense

      Comment


        I am running into big issues and I do not know how to solve it.

        My UE 4.22 (UE 4.22-Oculus build from source) project, using the latest version of this plugin, running in Mac, disconnects the socket unexpectedly and is then no longer able to reconnect properly. I'm using manual connect and I'm *not* using a Plugin Scoped connection. Basically my projects send approx. 10 messages per 'tick'. With a slow tick internal, like one tick every second, it's stable and there are no problems. When I have the tick interbal on 0.1 second (so approx. 100 messages per second) it soon disconnects and cannot reconnect again. I see this in the log:

        ...
        SocketIOLog: SocketIO eKjVnNjoMd2x6eRHAAAB appears to have lost connection, reconnecting attempt 0 with delay 5000
        ...

        It then looks like it is rebuilding the connection. First to the default namespace and then to the namespace I was using. And the I get the same message 'lost connection' message again.

        First of all I'm worried about the initial disconnect and the consecutive disconnects (after reconnect).

        I'm using a node.js server with socket.io version 2.2.0.

        Any ideas why this is happening?

        What's the C++ Socket IO client version that is being used? There may be a version mismatch. I have seen some reports about socket.io that indicate that you should make sure version is on par with server version.

        Any help is appreciated.
        Last edited by iambeeblebrox42; 05-09-2019, 02:45 AM.

        Comment


          Hi,

          anybody can give me a hint how to get dynamic "rooms" for clients to join? (via room-ids)
          Server-Side its something like this:

          Code:
          // attach Socket.io to our HTTP server
          io = socketio.listen(server);
          
          // handle incoming connections from clients
          io.sockets.on('connection', function(socket) {
              // once a client has connected, we expect to get a ping from them saying what room they want to join
              socket.on('room', function(room) {
                  socket.join(room);
              });
          });
          
          // now, it's easy to send a message to just the clients in a given room
          room = "abc123";
          io.sockets.in(room).emit('message', 'what is going on, party people?');
          
          // this message will NOT go to the client defined above
          io.sockets.in('foobar').emit('message', 'anyone in this room yet?');
          but how to do the client-side via Blueprints?
          Client-Side:

          Code:
           // set-up a connection between the client and the server
          var socket = io.connect();  
          // let's assume that the client page, once rendered, knows what room it wants to join
          var room = "abc123";  
          socket.on('connect', function() {    
          // Connected, let's sign-up for to receive messages for this room    
          socket.emit('room', room); });  
          socket.on('message', function(data) {    
          console.log('Incoming message:', data); });
          Thanks in advance for help :-)

          Comment


            Is it possible just to use this for JSON-RPC calls, or its not really in scope of this plugin?

            Comment


              Hey,

              I got your Android supported release, for 4.22, and built for 4.20. It doesn't want to connect from my phone though.. I put the address and port as http://192.168.0.101:3000, it works when I play in the viewport but not when I build to my phone. It's connected to the same Internet etc. Is there anything extra that I need to do?

              Comment


                Running into Errors everytime I start the Project, the Socket.io Actor Component is undefined, and thus breaks all blueprint notes and routes. And idk why. Anyone had this happen too them?

                Comment


                  Originally posted by iambeeblebrox42 View Post
                  I am running into big issues and I do not know how to solve it.

                  My UE 4.22 (UE 4.22-Oculus build from source) project, using the latest version of this plugin, running in Mac, disconnects the socket unexpectedly and is then no longer able to reconnect properly. I'm using manual connect and I'm *not* using a Plugin Scoped connection. Basically my projects send approx. 10 messages per 'tick'. With a slow tick internal, like one tick every second, it's stable and there are no problems. When I have the tick interbal on 0.1 second (so approx. 100 messages per second) it soon disconnects and cannot reconnect again. I see this in the log:

                  ...
                  SocketIOLog: SocketIO eKjVnNjoMd2x6eRHAAAB appears to have lost connection, reconnecting attempt 0 with delay 5000
                  ...

                  It then looks like it is rebuilding the connection. First to the default namespace and then to the namespace I was using. And the I get the same message 'lost connection' message again.

                  First of all I'm worried about the initial disconnect and the consecutive disconnects (after reconnect).

                  I'm using a node.js server with socket.io version 2.2.0.

                  Any ideas why this is happening?

                  What's the C++ Socket IO client version that is being used? There may be a version mismatch. I have seen some reports about socket.io that indicate that you should make sure version is on par with server version.

                  Any help is appreciated.
                  This is likely related to https://github.com/getnamo/socketio-...ue4/issues/126, I'm still looking into the root cause of this, it seems to only affect the latest (v1.0), but versions earlier than that don't support Mac.

                  What's interesting is that you're able to disconnect it by sending ~100 messages/sec which definitely shouldn't happen. I've added a new issue for this bug: https://github.com/getnamo/socketio-...ue4/issues/135 and I'll try to replicate it as well.

                  It may be a bit of time before I get to the bottom of these two. Thanks for the detailed issue descriptions!
                  Plugins: Node.js - TensorFlow - Socket.io Client - ZipUtility - Leap Motion - Hydra - Myo - RealSense

                  Comment


                    Originally posted by Bartolomeus76 View Post
                    Hi,

                    anybody can give me a hint how to get dynamic "rooms" for clients to join? (via room-ids)
                    Server-Side its something like this:

                    Code:
                    // attach Socket.io to our HTTP server
                    io = socketio.listen(server);
                    
                    // handle incoming connections from clients
                    io.sockets.on('connection', function(socket) {
                    // once a client has connected, we expect to get a ping from them saying what room they want to join
                    socket.on('room', function(room) {
                    socket.join(room);
                    });
                    });
                    
                    // now, it's easy to send a message to just the clients in a given room
                    room = "abc123";
                    io.sockets.in(room).emit('message', 'what is going on, party people?');
                    
                    // this message will NOT go to the client defined above
                    io.sockets.in('foobar').emit('message', 'anyone in this room yet?');
                    but how to do the client-side via Blueprints?
                    Client-Side:

                    Code:
                    // set-up a connection between the client and the server
                    var socket = io.connect();
                    // let's assume that the client page, once rendered, knows what room it wants to join
                    var room = "abc123";
                    socket.on('connect', function() {
                    // Connected, let's sign-up for to receive messages for this room
                    socket.emit('room', room); });
                    socket.on('message', function(data) {
                    console.log('Incoming message:', data); });
                    Thanks in advance for help :-)
                    It looks like you just connect and emit to the 'room' event name with 'abc123' room string id.

                    The equivalent in blueprints is

                    but with the changed event names/message value.

                    Also in your begin play you'd bind to the event 'message'


                    Full documentation is available at

                    https://github.com/getnamo/socketio-...se---bp-basics
                    Plugins: Node.js - TensorFlow - Socket.io Client - ZipUtility - Leap Motion - Hydra - Myo - RealSense

                    Comment


                      Originally posted by RyuMaster View Post
                      Is it possible just to use this for JSON-RPC calls, or its not really in scope of this plugin?
                      If you mean using the socket.io protocol to do JSON-RPC calls, this is supported since both ends can understand and parse json.

                      You can use e.g. https://github.com/getnamo/socketio-...-with-callback and emit and receive calls, the server can use this passed in callback to remotely callback https://github.com/getnamo/socketio-...server-example. You'd only need to make sure you follow jsonrpc spec (https://www.jsonrpc.org/specification) in your communication.


                      If you meant doing basic JSON http requests, this is supported albeit not the main focus of the plugin. I've added an example for a JSON http post request https://github.com/getnamo/socketio-...-json-requests.
                      Plugins: Node.js - TensorFlow - Socket.io Client - ZipUtility - Leap Motion - Hydra - Myo - RealSense

                      Comment


                        Originally posted by Metaverum View Post
                        Hey,

                        I got your Android supported release, for 4.22, and built for 4.20. It doesn't want to connect from my phone though.. I put the address and port as http://192.168.0.101:3000, it works when I play in the viewport but not when I build to my phone. It's connected to the same Internet etc. Is there anything extra that I need to do?
                        Please post to https://github.com/getnamo/socketio-client-ue4/issues with a detailed example of how you tried to make it work (steps to reproduce)
                        Plugins: Node.js - TensorFlow - Socket.io Client - ZipUtility - Leap Motion - Hydra - Myo - RealSense

                        Comment


                          Originally posted by Randolph Aarseth View Post
                          Running into Errors everytime I start the Project, the Socket.io Actor Component is undefined, and thus breaks all blueprint notes and routes. And idk why. Anyone had this happen too them?
                          Please post to https://github.com/getnamo/socketio-client-ue4/issues with detailed steps to reproduce problem (make sure to mention platform, unreal engine version)
                          Plugins: Node.js - TensorFlow - Socket.io Client - ZipUtility - Leap Motion - Hydra - Myo - RealSense

                          Comment


                            Im getting a recurrent crash editor error
                            Code:
                            LoginId:b469cbc2485f20c770183eb29b6e410f
                            EpicAccountId:781110064ffc457490880198fded0eed
                            
                            Assertion failed: [File:D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Private\GenericPlatform\GenericPlatformMemory.cpp] [Line: 212] Ran out of memory allocating 4756927107475439671 bytes with alignment 0
                            
                            UE4Editor_Core
                            UE4Editor_Core
                            UE4Editor_Core
                            UE4Editor_Core
                            UE4Editor_Core
                            UE4Editor_Core
                            UE4Editor_Core
                            UE4Editor_SocketIOLib!std::_Allocate<16,std::_Default_allocate_traits,0>() [C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\INCLUDE\xmemory0:175]
                            UE4Editor_SocketIOLib!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign() [C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\INCLUDE\xstring:2735]
                            UE4Editor_SocketIOLib!sio::client_impl::connect() [C:\Projects\SwordCombatIO\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\internal\sio_client_impl.cpp:119]
                            UE4Editor_SocketIOClient!<lambda_a9456e606c7f11acadc7b16ed18ccf60>::operator()() [C:\Projects\SwordCombatIO\Plugins\socketio-client-ue4\Source\SocketIOClient\Private\SocketIONative.cpp:59]
                            UE4Editor_CoreUtility!SetPromise<void>() [D:\Program Files\Epic Games\UE_4.22\Engine\Source\Runtime\Core\Public\Async\Async.h:59]
                            UE4Editor_CoreUtility!TAsyncRunnable<void>::Run() [D:\Program Files\Epic Games\UE_4.22\Engine\Source\Runtime\Core\Public\Async\Async.h:425]

                            Comment


                              Originally posted by DonFrag View Post
                              Im getting a recurrent crash editor error
                              Code:
                              LoginId:b469cbc2485f20c770183eb29b6e410f
                              EpicAccountId:781110064ffc457490880198fded0eed
                              
                              Assertion failed: [File:D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Private\GenericPlatform\GenericPlatformMemory.cpp] [Line: 212] Ran out of memory allocating 4756927107475439671 bytes with alignment 0
                              
                              UE4Editor_Core
                              UE4Editor_Core
                              UE4Editor_Core
                              UE4Editor_Core
                              UE4Editor_Core
                              UE4Editor_Core
                              UE4Editor_Core
                              UE4Editor_SocketIOLib!std::_Allocate<16,std::_Default_allocate_traits,0>() [C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\INCLUDE\xmemory0:175]
                              UE4Editor_SocketIOLib!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign() [C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\INCLUDE\xstring:2735]
                              UE4Editor_SocketIOLib!sio::client_impl::connect() [C:\Projects\SwordCombatIO\Plugins\socketio-client-ue4\Source\SocketIOLib\Private\internal\sio_client_impl.cpp:119]
                              UE4Editor_SocketIOClient!<lambda_a9456e606c7f11acadc7b16ed18ccf60>::operator()() [C:\Projects\SwordCombatIO\Plugins\socketio-client-ue4\Source\SocketIOClient\Private\SocketIONative.cpp:59]
                              UE4Editor_CoreUtility!SetPromise<void>() [D:\Program Files\Epic Games\UE_4.22\Engine\Source\Runtime\Core\Public\Async\Async.h:59]
                              UE4Editor_CoreUtility!TAsyncRunnable<void>::Run() [D:\Program Files\Epic Games\UE_4.22\Engine\Source\Runtime\Core\Public\Async\Async.h:425]
                              Got any context/ blueprints that cause that?
                              Plugins: Node.js - TensorFlow - Socket.io Client - ZipUtility - Leap Motion - Hydra - Myo - RealSense

                              Comment


                                Originally posted by getnamo View Post

                                Got any context/ blueprints that cause that?
                                When im testing the game i have two users connected. Then they start to connect and disconnect every time by no reason.
                                Then i close PIE, and when i try to play again and the connection hangs and the editor crashes

                                Comment

                                Working...
                                X