Closed royibernthal closed 1 year ago
replace ws:
by http:
and set the transporter to WebSocket like in:
var uri = new Uri("http://localhost:8090");
socket = new SocketIOUnity(uri, new SocketIOOptions
{
Query = new Dictionary<string, string>
{
//{"token", "UNITY" }
}
,
Transport = SocketIOClient.Transport.TransportProtocol.WebSocket
});
add the other callbacks so you know in which phase the socket get disconnected:
socket.OnError += (sender, e) => {
Debug.Log("OnError: " + e);
};
socket.OnPing += (sender, e) =>
{
Debug.Print("Ping");
};
socket.OnPong += (sender, e) =>
{
Debug.Print("Pong: " + e.TotalMilliseconds);
};
socket.OnDisconnected += (sender, e) =>
{
Debug.Print("disconnect: " + e);
};
socket.OnReconnectAttempt += (sender, e) =>
{
Debug.Print($"{DateTime.Now} Reconnecting: attempt = {e}");
};
I did everything you said, none of the callbacks were called except for the usual ping pong.
It seems socket.On("exception"...) works.
When emitting the "message" event, I'm throwing an exception on the server on purpose. I'm expecting OnError to trigger, but it doesn't.
This is the exception packet I captured from the server, which doesn't trigger OnError on the client.
42["exception",{"status":"error","message":"test"}]