While I am running my java code to connect to websocket, I am getting below error message:
connect:socket.fyers.in/hsm/v1-5/prod
OnMessage: {“code”:200,“type”:“cn”,“message”:“Authentication done”}
On open: HSM Connected
OnMessage: {“code”:200,“type”:“full”,“message”:“Full Mode On”}
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
On Error: {“code”:-15,“s”:“error”,“type”:“sf”,“message”:“Could not subscribe : Please provide valid token”}
========================
I am using below java code, Pls check the code and suggest what is missing here:
public static void main(String[] args) {
String clientID = "ABCDEF...-100";
String liveToken = "eyJ....";
FyersClass fyersClass = FyersClass.getInstance();
fyersClass.clientId = clientID;
fyersClass.accessToken = liveToken;
Step_3 step3 = new Step_3();
step3.WebSocket();
}
public void WebSocket() {
List scripList = new ArrayList<>();
scripList.add("NSE:SBIN-EQ"); // test first
FyersSocket fyersSocket = new FyersSocket(3);
fyersSocket.webSocketDelegate = this;
fyersSocket.ConnectHSM(ChannelModes.FULL);
fyersSocket.SubscribeData(scripList);
}