You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into a similar problem and the solution is quite simple. You have to use your host's IP address rather than localhost -- this goes for all clients (i.e different devices or scripts). For clarity, look up your IPv4 address (it should be something like 192.168.X.X) and replace localhost with the IP address which should result in looking something more like "ws://192.168.X.X:3000".
Also note that this is only on local networks (which should be on the same router!).
@Steve-Morales sadly that didn't solve it.
I have the same issue. I have a Node.js server and I am able to connect from terminal, local website, remote website but I simply can't connect with Unity. I tried localhost/127/192/hosts and nothing worked for Unity.
I even created new URL in /etc/hosts/ and used Docker for more separation. Nothing.
string address = "unity-sockets.com:8080";
// this connects fine
UnityWebRequest webReq = new($"http://{address}", "GET");
webReq.SendWebRequest();
// this won't even ping the server
websocket = new WebSocket($"ws://{address}");
websocket.Connect();
I tried to create a local https/wss server but it won't connect due to certificate issue. Still, the socket did not even ping the server.
`
public class WebSocketController : MonoBehaviour
{
WebSocket websocket;
#if !UNITY_WEBGL || UNITY_EDITOR
websocket.DispatchMessageQueue();
#endif
}
`
The text was updated successfully, but these errors were encountered: