Announcement

Collapse
No announcement yet.

[Plugin] Socket.io Client

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

  • replied
    Originally posted by DK Buzzin View Post

    Super unfortunate that Socket.IO isn't compiled to work with HTML5. I know that Low Entry plugins have been made to work with HTML5 packaging and use. However, its 2021 and socket fits more use cases than standard rest API's.
    You may want to check out this recommendation in the github issue tracking HTML5: https://github.com/getnamo/socketio-...ment-450806877. There's another open source websocket plugin that has HTML5 support via js wrapper scripts and it might be what you're looking for (albeit raw websockets vs socket.io).

    Leave a comment:


  • replied
    Originally posted by getnamo View Post

    I'm not aware of any UE4 code plugin working with HTML5. If there is documentation on how to get that working I'd be interested to see it. The plugin so far supports Windows and Linux platforms, but it's open source so if any contributors get something working, consider making a pull request and I'll include it.

    Your best bet at this time would probably to use inbuilt UE4 get/post html commands.





    ​​​​​​https isn't currently supported (use http) due to a bug in the underlying library which requires OpenSSL to be compiled in and use two different paths based on endpoints. Issue is currently tracked here https://github.com/getnamo/socketio-...-ue4/issues/39
    Super unfortunate that Socket.IO isn't compiled to work with HTML5. I know that Low Entry plugins have been made to work with HTML5 packaging and use. However, its 2021 and socket fits more use cases than standard rest API's.

    Leave a comment:


  • replied
    Originally posted by DK Buzzin View Post
    Hi there! ....
    Update. I tried downloading the 4.23 version of the plugin through github, adding the plugin folder to my project, and packaging that way. I also added "HTML5" to the platform whitelist in the uplugin file.

    When I do things this way now the project fails to package. I am going to post the log below. If I can't get this to work in the next 48 hours I am going to ditch the plugin and go with basic http requests. That is less than ideal though because my app is based on two way communication.

    Packaging Log:

    In file included from D:\Documents\ChessLeague\UE4ChessLeague\ChessLeague\Plugins\socketio-client-ue4\Source\ThirdParty\websocketpp\websocketpp/connection.hpp:1640:
    D:\Documents\ChessLeague\UE4ChessLeague\ChessLeague\Plugins\socketio-client-ue4\Source\ThirdParty\websocketpp\websocketpp/impl/connection_impl.hpp(228,9): error: cannot use 'throw' with exceptions disabled
    throw exception(ec);
    ^
    D:\Documents\ChessLeague\UE4ChessLeague\ChessLeague\Plugins\socketio-client-ue4\Source\ThirdParty\websocketpp\websocketpp/impl/connection_impl.hpp(299,9): error: cannot use 'throw' with exceptions disabled
    throw exception(ec);
    ^
    D:\Documents\ChessLeague\UE4ChessLeague\ChessLeague\Plugins\socketio-client-ue4\Source\ThirdParty\websocketpp\websocketpp/impl/connection_impl.hpp(332,9): error: cannot use 'throw' with exceptions disabled
    throw exception(ec);
    ^
    D:\Documents\ChessLeague\UE4ChessLeague\ChessLeague\Plugins\socketio-client-ue4\Source\ThirdParty\websocketpp\websocketpp/impl/connection_impl.hpp(482,9): error: cannot use 'throw' with exceptions disabled
    throw exception(ec);
    ^
    D:\Documents\ChessLeague\UE4ChessLeague\ChessLeague\Plugins\socketio-client-ue4\Source\ThirdParty\websocketpp\websocketpp/impl/connection_impl.hpp(520,9): error: cannot use 'throw' with exceptions disabled
    throw exception(ec);
    ^
    D:\Documents\ChessLeague\UE4ChessLeague\ChessLeague\Plugins\socketio-client-ue4\Source\ThirdParty\websocketpp\websocketpp/impl/connection_impl.hpp(548,9): error: cannot use 'throw' with exceptions disabled
    throw exception("Call to set_status from invalid state",
    ^

    Leave a comment:


  • replied
    Hi there! I just bought your plugin today and have been trying to get it to work with HTML 5. When I run it in editor (or packaged for windows) it is able to connect to the socket/ server just fine. However, when I package it out and run it in the browser, soon as I try to emit an event the game crashes and gives an error:

    Uncaught abort(197) at Error at jsStackTrace (blob:http://127.0.0.1:5500/0cd32848-f0c9-...1c50698:654:12) at stackTrace (blob:http://127.0.0.1:5500/0cd32848-f0c9-...1c50698:669:11) at abort (blob:http://127.0.0.1:5500/0cd32848-f0c9-...50698:21005:43) at nullFunc_viii (blob:http://127.0.0.1:5500/0cd32848-f0c9-...c50698:17194:2) at b197 (:wasm-function[130013]:0x3b8495d) at UObject::execCallMathFunction(UObject*, FFrame&, void*) [__ZN7UObject20execCallMathFunctionEPS_R6FFramePv] (:wasm-function[14313]:0x687dbf) at UObject::execLetObj(UObject*, FFrame&, void*) [__ZN7UObject10execLetObjEPS_R6FFramePv] (:wasm-function[14335]:0x68d639) at ProcessLocalScriptFunction(UObject*, FFrame&, void*) [__Z26ProcessLocalScriptFunctionP7UObjectR6FFramePv] (:wasm-function[14444]:0x69bc6c) at void ProcessScriptFunction(UObject*, UFunction*, FFrame&, void*, void (*)(UObject*, FFrame&, void*)) [__Z21ProcessScriptFunctionIPFvP7UObjectR6FFramePvEEvS1_P9UFunctionS3_S4_T_] (:wasm-function[14445]:0x69cc02) at ProcessLocalFunction(UObject*, UFunction*, FFrame&, void*) [__Z20ProcessLocalFunctionP7UObjectP9UFunctionR6FFramePv] (:wasm-function[14443]:0x69ae28)

    Has anyone tried using this plugin with HTML5? Any help or ideas appreciated.
    Last edited by DK Buzzin; 01-13-2021, 03:11 PM.

    Leave a comment:


  • replied
    Originally posted by Skalbe View Post

    Heya! Truly appreciate your activity here.
    Funnily enough my server test project stopped connecting to my local server from Quest after a rebuild again and I haven't a clue why, as I did not change any content. The rebuild was a sanity check test after I had replicated the settings to the main project with the content etc and it wouldn't work there either.
    I have tried cleaning everything through the ADB, uninstalling from Quest, rebuilding with deleting Intermediate folders etc, but nothing helps. I suspect it's something with the settings of permissions when deploying to the Quest, but I really don' t know. Would you perhaps have some pointers, as you are also working with the Quest?
    I definitely had it working once and I could just launch the server and launch the app from the quest and it connected, but no more.
    The next step that I will try is building with socket.io, I suppose, but I am building from Oculus 4.25.3 sdk branch and it keeps saying that the plugin is made for 4.25.0 and disabling it on build.

    Edit: still struggling to achieve consistent behavior for the connectivity. Sometimes when I build to Quest, it connects to the dedicated server, sometimes it just doesn't.
    And when I build server with socket.io, it gives me this: https://prnt.sc/ux7ius
    Am I supposed to install some third party stuff for this to work?
    if its disabling the plugin it won't work right. If you're using a custom branch remove the engine version field from uplugin file and make sure your project has socket.io client plugin as a dependency in the uproject file.

    With those, recompile your project and it should re compile the plugin for your engine version.

    Usually when I dev quest stuff I just use a canonical engine version and select android as build target with relevant oculus plugins enabled, so YMMV.

    Leave a comment:


  • replied
    Originally posted by getnamo View Post

    I use this plugin to connect services to quest projects, so it definitely compiles are and runs on the quest. You just need a socket.io type server and point your quest client to the server url or ip with port thats running the socket.io server.
    Heya! Truly appreciate your activity here.
    Funnily enough my server test project stopped connecting to my local server from Quest after a rebuild again and I haven't a clue why, as I did not change any content. The rebuild was a sanity check test after I had replicated the settings to the main project with the content etc and it wouldn't work there either.
    I have tried cleaning everything through the ADB, uninstalling from Quest, rebuilding with deleting Intermediate folders etc, but nothing helps. I suspect it's something with the settings of permissions when deploying to the Quest, but I really don' t know. Would you perhaps have some pointers, as you are also working with the Quest?
    I definitely had it working once and I could just launch the server and launch the app from the quest and it connected, but no more.
    The next step that I will try is building with socket.io, I suppose, but I am building from Oculus 4.25.3 sdk branch and it keeps saying that the plugin is made for 4.25.0 and disabling it on build.

    Edit: still struggling to achieve consistent behavior for the connectivity. Sometimes when I build to Quest, it connects to the dedicated server, sometimes it just doesn't.
    And when I build server with socket.io, it gives me this: https://prnt.sc/ux7ius
    Am I supposed to install some third party stuff for this to work?
    Last edited by Skalbe; 10-11-2020, 12:11 PM.

    Leave a comment:


  • replied
    Originally posted by Skalbe View Post
    I am trying to develop a technical demo for Oculus Quest and my current ordeal is that it wont connect to a dedicated host server on the local WiFi network. Both machines are on the same network and I can ping the oculus quest from the server machine. Don't know how to ping the machine from the Quest, but regardless, the game can connect to the dedicated server from another windows machine that is on the same network, but not from the oculus, which runs android. I`ve added all the possible permissions to the android permission list, but to no avail. Oculus runs Android so I`m wondering if this plugin could solve my issue out of the box, but it seems like it deals with just communication layer, not the connection layer.
    Would be thankful if someone could confirm or deny this. Or maybe someone has experience building this plugin into an android game and connecting to another device.

    Weirdly enough, today it decided to start working just as intended without any additional hassle. Updated and rebuilt the engine and rebuilt the project, although I had done it before like times 10 at least.
    I use this plugin to connect services to quest projects, so it definitely compiles are and runs on the quest. You just need a socket.io type server and point your quest client to the server url or ip with port thats running the socket.io server.

    Leave a comment:


  • replied
    I am trying to develop a technical demo for Oculus Quest and my current ordeal is that it wont connect to a dedicated host server on the local WiFi network. Both machines are on the same network and I can ping the oculus quest from the server machine. Don't know how to ping the machine from the Quest, but regardless, the game can connect to the dedicated server from another windows machine that is on the same network, but not from the oculus, which runs android. I`ve added all the possible permissions to the android permission list, but to no avail. Oculus runs Android so I`m wondering if this plugin could solve my issue out of the box, but it seems like it deals with just communication layer, not the connection layer.
    Would be thankful if someone could confirm or deny this. Or maybe someone has experience building this plugin into an android game and connecting to another device.

    Weirdly enough, today it decided to start working just as intended without any additional hassle. Updated and rebuilt the engine and rebuilt the project, although I had done it before like times 10 at least.
    Last edited by Skalbe; 10-07-2020, 07:47 AM.

    Leave a comment:


  • replied
    Originally posted by osclindstrm View Post
    We are getting issues while trying to connect to our Socket.IO api.

    Basically the only log we recieve from the socket is this:
    Code:
    SocketIOLog: SocketIO Invalid appears to have lost connection, reconnecting attempt 0 with delay 5000
    .

    This is despite the not getting a connection started in the first place.

    I have changed the sio_client_impl.h & cpp files to use TLS by adding this line
    Code:
    #define SIO_TLS 1
    as well as adding "OpenSSL" to the private and public dependency modules of SocketIOLib.Buid file. Had to fix some compilation errors but everything builds fine now.

    This is what my connection code looks like:
    Code:
    TSharedPtr<FJsonObject> QueryParams = MakeShareable(new FJsonObject);
    QueryParams->SetStringField("token", TokenForPlay);
    
    Socket->VerboseLog = true;
    Socket->Connect(FString(Base_URL + "/play"), QueryParams, nullptr);
    
    Socket->OnConnectedCallback = [this](const FString& InSessionId)
    {
    Log(2, "Connected", Info);
    };
    Our socket lives under the resouce /play (https://api.xxxxx.com/play). I've tried every different configuration(joining the /play namespace, only using the base url etc. ) that I've been able to come up with and nothing has worked so far. I don't know if I'm being fooled by the log message and TLS is actually not being used. I've tried to look through the implementation, and I'm at my wits end.

    Any help is greatly appreciated.
    TLS/SSL is currently not supported, it requires some fixes in the underlying library used. See this issue for a workaround used in the past: https://github.com/getnamo/socketio-...-ue4/issues/39

    Leave a comment:


  • replied
    We are getting issues while trying to connect to our Socket.IO api.

    Basically the only log we recieve from the socket is this:
    Code:
    SocketIOLog: SocketIO Invalid appears to have lost connection, reconnecting attempt 0 with delay 5000
    .

    This is despite the not getting a connection started in the first place.

    I have changed the sio_client_impl.h & cpp files to use TLS by adding this line
    Code:
    #define SIO_TLS 1
    as well as adding "OpenSSL" to the private and public dependency modules of SocketIOLib.Buid file. Had to fix some compilation errors but everything builds fine now.

    This is what my connection code looks like:
    Code:
    TSharedPtr<FJsonObject> QueryParams = MakeShareable(new FJsonObject);
    QueryParams->SetStringField("token", TokenForPlay);
    
    Socket->VerboseLog = true;
    Socket->Connect(FString(Base_URL + "/play"), QueryParams, nullptr);
    
    Socket->OnConnectedCallback = [this](const FString& InSessionId)
    {
    Log(2, "Connected", Info);
    };
    Our socket lives under the resouce /play (https://api.xxxxx.com/play). I've tried every different configuration(joining the /play namespace, only using the base url etc. ) that I've been able to come up with and nothing has worked so far. I don't know if I'm being fooled by the log message and TLS is actually not being used. I've tried to look through the implementation, and I'm at my wits end.

    Any help is greatly appreciated.
    Last edited by osclindstrm; 09-29-2020, 05:47 AM.

    Leave a comment:


  • replied
    I have been trying to upgrade my project to 4.25 version, but this Plugin gives me an error when packaging the game. No errors when compiling. Any updates to the plugin? Thanks!

    Leave a comment:


  • replied
    Originally posted by DonFrag View Post
    Just fyi, i wanted to implement websockets instead of socket.io and i realized that you are using a external websocket library, buy i found that ue4 has its own websocket library, in case you need to replace for a internal solution.
    I appreciate the ping, that said the internal library (libWebSockets) has a few features missing compared to the external lib (websocketpp: largely c++11 vs c api and more control over underlying functionality) and with the boost-less build process used since v1.0, using the external library is painless. It would take a very specific advantage for the third party dependency to be swapped.

    Leave a comment:


  • replied
    Just fyi, i wanted to implement websockets instead of socket.io and i realized that you are using a external websocket library, buy i found that ue4 has its own websocket library, in case you need to replace for a internal solution.

    Leave a comment:


  • replied
    Originally posted by HashemShepard View Post

    thanks for your reply , i switched to the http version and still got the exact same error , anything else to try ?
    Open an issue with detailed steps to reproduce the error on https://github.com/getnamo/socketio-client-ue4/issues and I'll try to help

    Leave a comment:


  • replied
    Originally posted by getnamo View Post

    https /SSL is currently not supported yet, use http. See https://github.com/getnamo/socketio-...-ue4/issues/39 for updates on the issue
    thanks for your reply , i switched to the http version and still got the exact same error , anything else to try ?

    Leave a comment:

Working...
X