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: GitHub - itisnajim/SocketIOUnity: A Wrapper for socket.io-client-csharp to work with Unity.
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!
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.