sacOO7 / socketcluster-client-java

Native java and android client for socketcluster framework in node.js
http://socketcluster.io/
Apache License 2.0
94 stars 42 forks source link

connect with auth - error #25

Open aviolide opened 6 years ago

aviolide commented 6 years ago

try connect with apikey and apisecret to wss://sc-02.coinigy.com/socketcluster/. in Socket.java change connection code -

            `JSONObject handshakeObject=new JSONObject();
            handshakeObject.put("event","#handshake");

            JSONObject obj = new JSONObject();
            obj.put("apiKey", "api");
            obj.put("apiSecret", "secret");

            JSONObject object=new JSONObject();
            object.put("authToken",obj.toString());
            handshakeObject.put("data",object);
            handshakeObject.put("cid",counter.getAndIncrement());
            websocket.sendText(handshakeObject.toString());`

and return - {"authError":{"name":"AuthTokenInvalidError","message":"jwt malformed"},"pingTimeout":20000,"id":"v45cx9vKX-xQXD1BAGmo","isAuthenticated":false} as i understand - it because the authtoken dont encode by jwt, can u provide the sample of working code with api auth?

aviolide commented 6 years ago

i find the issue. the library is not designed to make secure connection. api and secret must be encoded with JWT. but if you do the correct auth, the async between request is broken

sacOO7 commented 6 years ago

Hi @desided , Can you please take a look here for solution https://github.com/sacOO7/socketcluster-client-java/issues/17. I am pretty sure it is supposed to work. Please let me know if you have any other issues. If you are facing any other problem, I will directly put working code in here....

sacOO7 commented 6 years ago

HI @desided , the issue is probably due to coinigy server problem. They have shut it down due to some load balancing issues. You will find more details here Coinigy/api#34