Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Multiplayer game using Socket.io/NodeJS not working on iOS?

Discussion in 'iOS and tvOS' started by ewanross55, Jul 8, 2023.

  1. ewanross55

    ewanross55

    Joined:
    May 5, 2020
    Posts:
    1
    I'm building a simple multiplayer game in Unity using Node JS and Sockets IO. The server is hosted on AWS.

    To connect to the server in the game I am using the following library: https://github.com/itisnajim/SocketIOUnity.git

    When testing this in the Unity simulator a connection is made successfully and all data is received and emitted correctly. However when I make a build for iOS no data is received or emitted. I've setup some trivial debugging for this but I haven't found much documentation on it for the actual socket connections. It's also not clear reading the backtrace on Xcode what the issue is.

    After reading through many posts here I thought that the issue was related to SSL or some other security problem so I setup a domain name and SSL on port 3000 (with HTTPS) thinking this may fix it. But this did not fix it.

    After more digging I thought it could be related to the actual configuration on Xcode so I enabled the domain name/IP through an App Transport Security Exception (via signing and capabilitites) as well as enabling all Network Extensions. But still no luck.

    What is strange is that if it runs fine in the Unity Editor then I know the code itself works, meaning there must be a security related issue somewhere?

    If anyone has any idea any help would be much appreciated!

    Posts I've already looked at:

    What I've tried to solve this so far:

    • updating the Unity Editor to the latest version
    • setting up a server on AWS with HTTPS on port 3000
    • enabling all network extensions in Xcode
    • adding an App Transport Security Exception in Xcode
    • reading other posts on stack overflow
    • reading documentation on the existing package
    • adding debugging to the scripts
    What I'm expecting is the same behaviour I get in the Unity Simulator to appear on my iPhone. I.e. it makes a successful connection with my NodeJS server and receives/emits data correctly.
     
    Burlyduck likes this.