Reputation: 160
I am trying to connect a client to the GameWisp Realtime API using WebSocket4Net. My connection code looks like this:
public void Connect(string OAuth)
{
LoginData login = new LoginData(GAMEWISP_CLIENT_ID, GAMEWISP_CLIENT_SECRET);
Console.WriteLine("OAtuh = " + OAuth);
socket = new Client("https://singularity.gamewisp.com");
Console.WriteLine("Trying to connect");
try
{
socket.Connect();
}
catch(Exception e)
{
Console.WriteLine(e.StackTrace);
return;
}
Console.WriteLine("awaiting response");
socket.On("connect", (data) =>
{
Console.WriteLine(data);
socket.Emit("authenticate", JsonConvert.SerializeObject(login));
});
socket.On("authenticated",(data) => {Console.WriteLine(data);});
}
But uppon running this code I get the following console output:
OAtuh = abc
Trying to connect
Error Event: Error initializing handshake with https://singularity.gamewisp.com/
System.Exception: Eine Ausnahme vom Typ "System.Exception" wurde ausgelöst.
awaiting response
I understand, that if the handshake fails no connection will be established, and therefor I wont be recieving the 'connect' event.
But how can I fix this to make the handshake work, or even just get more information about what exactly went wrong?
Edit: After doing some research I have discovered, that WebSocket4Net supports the 'socket.io version 0.9.x' but if I am not mistakend I would require 'v1.2.x' if I go by the example given on the GameWisp website:
<!doctype html>
<html>
<head>
<script src="https://cdn.socket.io/socket.io-1.2.0.js"></script>
...
So now I have to find a different approach. I could use a hint as to how to establish a connection, as well as sending and recieving data.
Upvotes: 1
Views: 160