Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Bug Can't connect to SocketIOUnity on Build

Discussion in 'Scripting' started by akashsinha43, Apr 26, 2024.

  1. akashsinha43

    akashsinha43

    Joined:
    Sep 1, 2022
    Posts:
    2
    I have game where I'm using socket io in node.js as a server. I want to connect to unity as client and that works in the editor. All the functions work in the editor but on Build the socket doesn't connect only. The package I am using is https://github.com/itisnajim/SocketIOUnity.
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    7,019
    Build is WebGL? On the web, you have to use WebSockets. Does this package automatically switch to using WebSockets in web builds? This may required extra steps. Check whatever there may be in terms of documentation.
     
  3. akashsinha43

    akashsinha43

    Joined:
    Sep 1, 2022
    Posts:
    2
    Thanks for the quick reply, as per the documentation, this package only supports Android and PC platforms. However, it says that running on other platforms might lead to "unwanted" behavior. It also suggests that the package might not work in the Editor. But in my case it's working fine. Apart from that, I've seen people using this package to implement WebSockets in WebGL builds.
    Is there any kind of documentation or tutorial you might point me to?