websocket not receive data

RH1558
not get response from websocket tested following code on other websocket website "wss://qa.sockets.stackexchange.com/" there it work but not work on "wss://websocket.kite.trade"

Following is my sample code for websocket
try
{
String url = "wss://websocket.kite.trade/?api_key="+apikey+"&user_id="+uid+"&public_token="+PublicToken;

URI endpointURI = new URI(url);

SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setTrustAll(true); // The magic

WebSocketClient client = new WebSocketClient(sslContextFactory);

client.start();
WebSocketConn socket = new WebSocketConn();
Future fut = client.connect(socket, endpointURI);
Session session = fut.get();
session.getRemote().sendString("{\"a\": \"subscribe\", \"v\": [408065, 884737]}");
}
catch (URISyntaxException e)
{
e.printStackTrace();
}
catch (Exception e)
{
e.printStackTrace();
}

is some thing wrong with session.getRemote().sendString("{\"a\": \"subscribe\", \"v\": [408065, 884737]}"); i send string and server need JSON or other format
  • Kailash
    Even if your sendString() is wrong (it has to be valid JSON), the connection should still be established. When you do client.connect(), is it establishing the connection or is there an error? Also, are you getting the 1-byte/sec heartbeat?

    Finally, have you tried https://github.com/instruritesh/ZStreamingQuote ? It's a ready made Java Kite Connect WebSocket library.
  • RH1558
    please close this question
This discussion has been closed.