Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't authenticate using Socketcluster V2 for Coinigy Exchange websocket ticker api

I'm trying to use the ticker data for the Coinigy websocket api, to get the stream of real time trades and prices of crypto assets.

I've tried the following demo with no success, and I get a response of:
"Socket is not authenticated"

internal class MyListener:BasicListener
{
    public void onConnected(Socket socket)
    {
        Console.WriteLine("connected got called");
    }

    public void onDisconnected(Socket socket)
    {
        Console.WriteLine("disconnected got called");
    }

    public void onConnectError(Socket socket, ErrorEventArgs e)
    {
        Console.WriteLine("on connect error got called");
    }

    public void onAuthentication(Socket socket, bool status)
    {
        Console.WriteLine(status ? "Socket is authenticated" : "Socket is not authenticated");
    }

    public void onSetAuthToken(string token, Socket socket)
    {
        token = "{'apiKey' : 'KEYXXXXXX', 'apiSecret' : 'SECRETXXXX'}"; //<---MY key and secret
        socket.setAuthToken(token);
        Console.WriteLine("on set auth token got called");
    }

}

internal class Program
{
    public static void Main(string[] args)
    {
        var socket=new Socket("wss://sc-02.coinigy.com/socketcluster/");
        socket.setListerner(new MyListener());

        socket.setReconnectStrategy(new ReconnectStrategy().setMaxAttempts(30));
        socket.connect();


//Other code calling the websocket....
//Other code calling the websocket....
//Other code calling the websocket....
        Console.ReadKey();


    }
}
like image 254
Carlo Luther Avatar asked Nov 07 '22 17:11

Carlo Luther


1 Answers

I had the same problem. There are a few things you need to know:

1) The TICKER API is deprecated: Coinigy Blog

2) I only got an authenticated connection with another C# library named Pure Socket Cluster

3) You need to access your private channel to get the realtime data now

4) It will fetch your favorites, configured via settings on the webpage

5) You only get a handful of favorites back. Not everything you selected. I have not found any additional information to remove the limit or expand it or why there is one.

like image 68
Michael A. Volz aka Flynn Avatar answered Nov 14 '22 21:11

Michael A. Volz aka Flynn