Announcement

Collapse
No announcement yet.

[Plugin] Socket.io Client

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

    #61
    Hey getnamo!

    Thank you very much for the plugin it is awesome, although I have started using it in 4.15.1 and I have some strange error while emiting event, my unreal crashes with fatal error and in logs I found this:
    [2017.03.26-23.56.13:486][917]LogCrashTracker:


    [2017.03.26-23.56.13:486][917]LogWindows:Error: === Critical error: ===
    [2017.03.26-23.56.13:486][917]LogWindows:Error:
    [2017.03.26-23.56.13:486][917]LogWindows:Error: Fatal error!
    [2017.03.26-23.56.13:486][917]LogWindows:Error:
    [2017.03.26-23.56.13:486][917]LogWindows:Error: Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000038
    [2017.03.26-23.56.13:486][917]LogWindows:Error:
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor-SocketIOClient.dll!USIOMessageConvert::ToSIOMessage() [c:\users\newicz\documents\unreal projects\ao\plugins\socketio-client-ue4\source\socketioclient\private\siomessageconvert.cpp:83]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor-SocketIOClient.dll!USocketIOClientComponent::Emit() [c:\users\newicz\documents\unreal projects\ao\plugins\socketio-client-ue4\source\socketioclient\private\socketioclientcomponent.cpp:179]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor-SocketIOClient.dll!USocketIOClientComponent::execEmit() [c:\users\newicz\documents\unreal projects\ao\plugins\socketio-client-ue4\source\socketioclient\public\socketioclientcomponent.h:52]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor-CoreUObject.dll!UFunction::Invoke() [c:\unrealengine-4.15\engine\source\runtime\coreuobject\private\uobject\class.cpp:4525]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor-CoreUObject.dll!UObject::CallFunction() [c:\unrealengine-4.15\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:721]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor-CoreUObject.dll!UObject::ProcessContextOpcode() [c:\unrealengine-4.15\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:2149]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor-CoreUObject.dll!UObject::ProcessInternal() [c:\unrealengine-4.15\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:948]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor-CoreUObject.dll!UFunction::Invoke() [c:\unrealengine-4.15\engine\source\runtime\coreuobject\private\uobject\class.cpp:4525]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor-CoreUObject.dll!UObject::ProcessEvent() [c:\unrealengine-4.15\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:1318]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor-Engine.dll!AActor::ProcessEvent() [c:\unrealengine-4.15\engine\source\runtime\engine\private\actor.cpp:684]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor-Engine.dll!FTimerUnifiedDelegate::Execute() [c:\unrealengine-4.15\engine\source\runtime\engine\public\timermanager.h:50]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor-Engine.dll!FTimerManager::Tick() [c:\unrealengine-4.15\engine\source\runtime\engine\private\timermanager.cpp:574]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor-Engine.dll!UWorld::Tick() [c:\unrealengine-4.15\engine\source\runtime\engine\private\leveltick.cpp:1427]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor-UnrealEd.dll!UEditorEngine::Tick() [c:\unrealengine-4.15\engine\source\editor\unrealed\private\editorengine.cpp:1630]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick() [c:\unrealengine-4.15\engine\source\editor\unrealed\private\unrealedengine.cpp:391]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor.exe!FEngineLoop::Tick() [c:\unrealengine-4.15\engine\source\runtime\launch\private\launchengineloop.cpp:3025]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor.exe!GuardedMain() [c:\unrealengine-4.15\engine\source\runtime\launch\private\launch.cpp:166]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor.exe!GuardedMainWrapper() [c:\unrealengine-4.15\engine\source\runtime\launch\private\windows\launchwindows.cpp:134]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor.exe!WinMain() [c:\unrealengine-4.15\engine\source\runtime\launch\private\windows\launchwindows.cpp:210]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: UE4Editor.exe!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253]
    [2017.03.26-23.56.13:486][917]LogWindows:Error: KERNEL32.DLL!0x0000000025388364
    [2017.03.26-23.56.13:486][917]LogWindows:Error: ntdll.dll!0x0000000027DD70D1
    [2017.03.26-23.56.13:486][917]LogWindows:Error: ntdll.dll!0x0000000027DD70D1
    [2017.03.26-23.56.13:486][917]LogWindows:Error:
    [2017.03.26-23.56.13:514][917]LogExit: Executing StaticShutdownAfterError
    [2017.03.26-23.56.13:521][917]LogWindows: FPlatformMisc::RequestExit(1)
    [2017.03.26-23.56.13:521][917]Log file closed, 03/27/17 01:56:13
    Do you have any idea what could cause it and how to fix it?

    Comment


      #62
      Originally posted by newicz View Post
      Hey getnamo!

      Thank you very much for the plugin it is awesome, although I have started using it in 4.15.1 and I have some strange error while emiting event, my unreal crashes with fatal error and in logs I found this:


      Do you have any idea what could cause it and how to fix it?
      Crash points to https://github.com/getnamo/socketio-...onvert.cpp#L83 which likely means JsonValue->Type dereferencing is failing on a null type pointer. What method are you using to generate the data you're emitting? struct->json? or manual object building? Maybe a blueprint picture or two could help replicating this crash.

      Originally posted by Dannington View Post
      Don't know if this helps - I rigged it so I can toggle a connect/disconnect and it crashed (in editor)

      Fatal error: [File:\Build\++UE4+Release-4.15+Compile\Sync\Engine\Source\Runtime\Core\Private\GenericPlatform\GenericPlatformMemory.cpp] [Line: 160]
      Ran out of memory allocating 4453159313439771895 bytes with alignment 0


      KERNELBASE
      UE4Editor_Core
      UE4Editor_Core
      UE4Editor_Core
      UE4Editor_Core
      UE4Editor_Core
      UE4Editor_SocketIOClient!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Copy() [c:\program files (x86)\microsoft visual studio 14.0\vc\include\xstring:2196]
      UE4Editor_SocketIOClient!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign() [c:\program files (x86)\microsoft visual studio 14.0\vc\include\xstring:1155]
      UE4Editor_SocketIOClient!sio::client_impl::connect()
      UE4Editor_SocketIOClient!sio::client::connect()
      UE4Editor_SocketIOClient!<lambda_528b49ce01ebae6e90043a74545a1705>:perator()() [c:\users\danrs\documents\unreal projects\damab_6_0\plugins\socketio-client-ue4\source\socketioclient\private\socketioclientcomponent.cpp:150]
      UE4Editor_SocketIOClient!FSIOLambdaRunnable::Run() [c:\users\danrs\documents\unreal projects\damab_6_0\plugins\socketio-client-ue4\source\socketioclient\private\siolambdarunnable.cpp:47]
      This should be helpful, looks like it's related to an invalid string pointer or size causing an oversized allocation. Not quite sure yet when I can carve the time to finally fix the disconnect bug. Any possibility to rig up and share a minimal example project that replicates the problem easily?
      Plugins: GES - Node.js - TensorFlow - Socket.io Client - ZipUtility - Leap Motion - Hydra - Myo

      Comment


        #63
        Maybe a blueprint picture or two could help replicating this crash.
        Sure I can give you whole example as it's very easy, it is clean ThirdPersonExample with starter content with custom GameMode containing only what you can see on screens. It is running with dedicated server in the background with 1 client. Engine version is 4.15.1 here are the screens from Unreal:

        Click image for larger version

Name:	GameMode.png
Views:	1
Size:	238.2 KB
ID:	1125662

        Click image for larger version

Name:	GameMode-EmitNow.png
Views:	1
Size:	300.2 KB
ID:	1125663

        Click image for larger version

Name:	Error.png
Views:	1
Size:	763.9 KB
ID:	1125664

        Here is the code for my node.js app (in TypeScript):

        Code:
        import * as express from 'express'
        import * as http from 'http'
        import * as socketIO from 'socket.io'
        
        import SelectPlayerNation from './src/SelectPlayerNation'
        
        const app = express()
        const server = http.createServer(app)
        var io = socketIO(server)
        
        io.on('connection', (socket) => {
            console.log('Game server connected from: ' + socket.handshake.address)
        
            socket.on('nationize', (msg) => {
                console.log('Selecting nation started...')
                if (SelectPlayerNation("a", 1)) {
                    console.log('Nation selected')
                    socket.emit('nation-selected')
                    return
                }
        
                console.log('Error while selecting nation')
                socket.emit('nation-selection-error')
            })
        })
        
        server.listen(3000, () => {
            console.log('Server listen on *:3000')
        })
        And here is SelectPlayerNation function that is imported:

        Code:
        export default function GetPlayerNation(sid:string):number {
            return 0;
        }
        PM2 Logs when I run the server and try to run Unreal client:
        Code:
        C:\Users\newicz\.pm2\pm2.log last 15 lines:
        PM2        | 2017-03-29 01:01:30: ===============================================================================
        PM2        | 2017-03-29 01:01:30: --- New PM2 Daemon started ----------------------------------------------------
        PM2        | 2017-03-29 01:01:30: Time                 : Wed Mar 29 2017 01:01:30 GMT+0200 (Central European Daylight Time)
        PM2        | 2017-03-29 01:01:30: PM2 version          : 2.4.2
        PM2        | 2017-03-29 01:01:30: Node.js version      : 6.10.1
        PM2        | 2017-03-29 01:01:30: Current arch         : x64
        PM2        | 2017-03-29 01:01:30: PM2 home             : C:\Users\newicz\.pm2
        PM2        | 2017-03-29 01:01:30: PM2 PID file         : C:\Users\newicz\.pm2\pm2.pid
        PM2        | 2017-03-29 01:01:30: RPC socket file      : \\.\pipe\rpc.sock
        PM2        | 2017-03-29 01:01:30: BUS socket file      : \\.\pipe\pub.sock
        PM2        | 2017-03-29 01:01:30: Application log path : C:\Users\newicz\.pm2\logs
        PM2        | 2017-03-29 01:01:30: Process dump file    : C:\Users\newicz\.pm2\dump.pm2
        PM2        | 2017-03-29 01:01:30: Concurrent actions   : 2
        PM2        | 2017-03-29 01:01:30: SIGTERM timeout      : 1600
        PM2        | 2017-03-29 01:01:30: ===============================================================================
        
        [STREAMING] Now streaming realtime logs for [all] processes
        PM2        | [Watch] Start watching 0
        PM2        | Starting execution sequence in -fork mode- for app name:api-app id:0
        PM2        | App name:api-app id:0 online
        0|api-app  | Server listen on *:3000
        0|api-app  | Game server connected from: ::1
        EDIT: SOLUTION FOUND
        I've found the reason it was emiting the clean event from nodejs app. Once I changed:

        Code:
        socket.emit('nation-selected')
        to

        Code:
        socket.emit('nation-selected', {})
        It worked just fine! Thank you for pointing me into right direction, I will leave this for others that may have problem with that.
        Last edited by newicz; 03-28-2017, 07:44 PM. Reason: Solution found

        Comment


          #64
          Originally posted by newicz View Post
          Sure I can give you whole example as it's very easy, it is clean ThirdPersonExample with starter content with custom GameMode containing only what you can see on screens. It is running with dedicated server in the background with 1 client. Engine version is 4.15.1 here are the screens from Unreal:

          [ATTACH=CONFIG]135109[/ATTACH]

          [ATTACH=CONFIG]135110[/ATTACH]

          [ATTACH=CONFIG]135111[/ATTACH]

          Here is the code for my node.js app (in TypeScript):

          Code:
          import * as express from 'express'
          import * as http from 'http'
          import * as socketIO from 'socket.io'
          
          import SelectPlayerNation from './src/SelectPlayerNation'
          
          const app = express()
          const server = http.createServer(app)
          var io = socketIO(server)
          
          io.on('connection', (socket) => {
              console.log('Game server connected from: ' + socket.handshake.address)
          
              socket.on('nationize', (msg) => {
                  console.log('Selecting nation started...')
                  if (SelectPlayerNation("a", 1)) {
                      console.log('Nation selected')
                      socket.emit('nation-selected')
                      return
                  }
          
                  console.log('Error while selecting nation')
                  socket.emit('nation-selection-error')
              })
          })
          
          server.listen(3000, () => {
              console.log('Server listen on *:3000')
          })
          And here is SelectPlayerNation function that is imported:

          Code:
          export default function GetPlayerNation(sid:string):number {
              return 0;
          }
          PM2 Logs when I run the server and try to run Unreal client:
          Code:
          C:\Users\newicz\.pm2\pm2.log last 15 lines:
          PM2        | 2017-03-29 01:01:30: ===============================================================================
          PM2        | 2017-03-29 01:01:30: --- New PM2 Daemon started ----------------------------------------------------
          PM2        | 2017-03-29 01:01:30: Time                 : Wed Mar 29 2017 01:01:30 GMT+0200 (Central European Daylight Time)
          PM2        | 2017-03-29 01:01:30: PM2 version          : 2.4.2
          PM2        | 2017-03-29 01:01:30: Node.js version      : 6.10.1
          PM2        | 2017-03-29 01:01:30: Current arch         : x64
          PM2        | 2017-03-29 01:01:30: PM2 home             : C:\Users\newicz\.pm2
          PM2        | 2017-03-29 01:01:30: PM2 PID file         : C:\Users\newicz\.pm2\pm2.pid
          PM2        | 2017-03-29 01:01:30: RPC socket file      : \\.\pipe\rpc.sock
          PM2        | 2017-03-29 01:01:30: BUS socket file      : \\.\pipe\pub.sock
          PM2        | 2017-03-29 01:01:30: Application log path : C:\Users\newicz\.pm2\logs
          PM2        | 2017-03-29 01:01:30: Process dump file    : C:\Users\newicz\.pm2\dump.pm2
          PM2        | 2017-03-29 01:01:30: Concurrent actions   : 2
          PM2        | 2017-03-29 01:01:30: SIGTERM timeout      : 1600
          PM2        | 2017-03-29 01:01:30: ===============================================================================
          
          [STREAMING] Now streaming realtime logs for [all] processes
          PM2        | [Watch] Start watching 0
          PM2        | Starting execution sequence in -fork mode- for app name:api-app id:0
          PM2        | App name:api-app id:0 online
          0|api-app  | Server listen on *:3000
          0|api-app  | Game server connected from: ::1
          EDIT: SOLUTION FOUND
          I've found the reason it was emiting the clean event from nodejs app. Once I changed:

          Code:
          socket.emit('nation-selected')
          to

          Code:
          socket.emit('nation-selected', {})
          It worked just fine! Thank you for pointing me into right direction, I will leave this for others that may have problem with that.
          That's great! That said it's still a bug from the plugin side, looks like I don't handle an empty message case on receive, I'll add another type check in there in case the JsonValue you get is none and see if that will fix it.
          Plugins: GES - Node.js - TensorFlow - Socket.io Client - ZipUtility - Leap Motion - Hydra - Myo

          Comment


            #65
            Hi Getnamo, I'll get you something sometime! I'm running up against crazy deadlines for the next 2/3 weeks or so, our show's going to air on the 18th.

            Comment


              #66
              Originally posted by Dannington View Post
              Hi Getnamo, I'll get you something sometime! I'm running up against crazy deadlines for the next 2/3 weeks or so, our show's going to air on the 18th.
              No rush Dan, things always take time

              Exciting stuff on the show, it would be awesome to see it action, maybe at the meetup?
              Plugins: GES - Node.js - TensorFlow - Socket.io Client - ZipUtility - Leap Motion - Hydra - Myo

              Comment


                #67
                Update to 0.5.2
                -Fixed boolean always returning false #35

                From 0.5.1
                -Fixed undefined as second emit parameter from server #36

                From 0.5.0
                -Fixes for disconnecting while communicating with an unreachable server #32
                -Boost updated to 1.62
                -Socket.io-cpp updated to latest master merge
                -misc internal features for tracking and killing lambda threads

                Grab the latest @ https://github.com/getnamo/socketio-client-ue4/releases

                Originally posted by newicz View Post

                ...

                Code:
                socket.emit('nation-selected')
                to

                Code:
                socket.emit('nation-selected', {})
                It worked just fine! Thank you for pointing me into right direction, I will leave this for others that may have problem with that.
                This is now fixed in 0.5.1 allowing you to leave the second parameter empty.

                [MENTION=4353]Dannington[/MENTION] [MENTION=706320]Avatarochnik[/MENTION] and anyone else who has had disconnect crashes, try the latest version for 4.15 (0.5.2) and let me know if the crashes and hangs have gone away.
                Last edited by getnamo; 04-04-2017, 02:45 AM.
                Plugins: GES - Node.js - TensorFlow - Socket.io Client - ZipUtility - Leap Motion - Hydra - Myo

                Comment


                  #68
                  Hi [MENTION=548]getnamo[/MENTION].

                  My PC is currently in a box coming back from France, but i'll test it as soon as I get back. Something I realised is that I nearly always do my builds as development builds rather than shipping so I can get access to the console, but for a presentation I did yesterday I made a shipping build and it was a lot less likely to crash (It did only once over the last 3 days on exit, whereas with a development build it would happen more often than not).

                  Thanks

                  Comment


                    #69
                    Hi [MENTION=548]getnamo[/MENTION].

                    On 4.15 and the most recent SocketIO, I'm also getting the bug where, when not using auto-connect, my packaged project crashes on loading a level.

                    Comment


                      #70
                      Thanks for this [MENTION=548]getnamo[/MENTION]! I would like to use this within an Online Subsystem. Is it possible? Do you have any suggestions on how to implement the client in c++ at this (sub actor) level?

                      Comment


                        #71
                        Originally posted by edcolmar View Post
                        Thanks for this [MENTION=548]getnamo[/MENTION]! I would like to use this within an Online Subsystem. Is it possible? Do you have any suggestions on how to implement the client in c++ at this (sub actor) level?
                        Not too familiar with the online subsystem layout, do you have some code scaffold of what you want to do?

                        Originally posted by Rockhopper View Post
                        Hi [MENTION=548]getnamo[/MENTION].

                        On 4.15 and the most recent SocketIO, I'm also getting the bug where, when not using auto-connect, my packaged project crashes on loading a level.
                        Noted, does it only happen in packaged projects? and do you have any logs you can PM me (found under Saved/Logs)?
                        Plugins: GES - Node.js - TensorFlow - Socket.io Client - ZipUtility - Leap Motion - Hydra - Myo

                        Comment


                          #72
                          [QUOTE=getnamo;701473]Not too familiar with the online subsystem layout, do you have some code scaffold of what you want to do?

                          Yes, all of the online subsystems have the same interface.

                          There are no actors involved, so using the actor component isn't going to work, right?

                          I started experimenting with it, but I haven't been having much success so far.

                          Comment


                            #73
                            Originally posted by edcolmar View Post
                            Originally posted by getnamo View Post
                            Not too familiar with the online subsystem layout, do you have some code scaffold of what you want to do?
                            Yes, all of the online subsystems have the same interface.

                            There are no actors involved, so using the actor component isn't going to work, right?

                            I started experimenting with it, but I haven't been having much success so far.
                            I should be able to refactor the plugin to encapsulate the C++ functionality in a pure C++ class e.g. FSocketIOClient which can then be used as a rebase for the ActorComponent (keep a local shared ptr, and forward all calls). This would allow you to add it anywhere in C++ via raw ptrs e.g. new FSocketIOClient or shared ptrs e.g. MakeSharedPtr(new FSocketIOClient) and not break any ActorComponent functionality while keeping a common core.

                            I've added the enhancement suggestion as an issue to the repo: https://github.com/getnamo/socketio-...-ue4/issues/43
                            Plugins: GES - Node.js - TensorFlow - Socket.io Client - ZipUtility - Leap Motion - Hydra - Myo

                            Comment


                              #74
                              [MENTION=548]getnamo[/MENTION] I did some more testing. As far as I can tell, yes, it only happens in packaged builds. Doesn't matter if it's packaged for shipping or development. Using Windows 64-bit build.

                              The situation is this: I load into a level just fine. Then I have seven blueprints with SocketIO components which all connect properly to my server. Everything is fine.

                              Then one of these seven blueprints emits a signal to the server, all of them disconnect from the server, and then I switch the level.

                              I'll PM you the logs, but it doesn't look like it's too helpful. I've narrowed it down to the disconnecting step causing the crash in the packaged version. It works without hitch in the editor. Thanks!

                              Comment


                                #75
                                Originally posted by getnamo View Post
                                I should be able to refactor the plugin to encapsulate the C++ functionality in a pure C++ class e.g. FSocketIOClient which can then be used as a rebase for the ActorComponent (keep a local shared ptr, and forward all calls). This would allow you to add it anywhere in C++ via raw ptrs e.g. new FSocketIOClient or shared ptrs e.g. MakeSharedPtr(new FSocketIOClient) and not break any ActorComponent functionality while keeping a common core.

                                I've added the enhancement suggestion as an issue to the repo: https://github.com/getnamo/socketio-...-ue4/issues/43
                                I managed to get the base implementation working. I ripped all of your code out of the plugin to do it though, so it's not really useful as a plugin anymore. I'll post what I did one I get a bit more testing on it.

                                Comment

                                Working...
                                X