Jump to content

lalittanna

Members
  • Posts

    2
  • Joined

  • Last visited

lalittanna's Achievements

New Contributor

New Contributor (1/10)

1

Reputation

  1. Thanks @KoketsoIG @bug-or-feature I've moved this as an issue on the Lightstreamer Github repo.
  2. I'm trying to get price feed on demo account through the streaming API but its returning this server error: lightstreamer.session|pool-2-thread-1|Disconnected. Cause: 65 - Unsupported protocol version: 2.5.0 Maven dependency used: <dependency> <groupId>com.lightstreamer</groupId> <artifactId>ls-javase-client</artifactId> <version>5.1.0</version> </dependency> Code: LightstreamerClient client = new LightstreamerClient("https://demo-apd.marketdatasystems.com", "DEMO"); ConsoleLoggerProvider mylog = new ConsoleLoggerProvider(ConsoleLogLevel.INFO); LightstreamerClient.setLoggerProvider(mylog); client.connectionDetails.setUser("<userId>"); client.connectionDetails.setPassword("CST-" + "389b6319947f6799bdcfbdf3fd2b5098f90dcdd8dd4ae655b4829b6047b035CC01116" + "|XST-" + "671c982d9852360a9af293fe9043fe7c86493e1eafa92b286e1dab7bd1029aCD01116"); client.connectionDetails.setAdapterSet("DEFAULT"); client.addListener(new ClientListener() { @Override public void onListenEnd() { System.out.println("Listening ended"); } @Override public void onListenStart() { System.out.println("Listening started"); } @Override public void onServerError(int i, @NotNull String s) { System.out.println("Server error: " + s); } @Override public void onStatusChange(@NotNull String s) { System.out.println("Status change: " + s); } @Override public void onPropertyChange(@NotNull String s) { System.out.println("Property change: " + s); } }); String[] items = { "CS.D.EURGBP.CFD.IP" }; String[] fields = { "BID","OFFER" }; Subscription sub = new Subscription("MERGE",items,fields); sub.setDataAdapter("QUOTE_ADAPTER"); sub.setRequestedSnapshot("yes"); sub.addListener(new SubscriptionListener() { @Override public void onClearSnapshot(String itemName, int itemPos) { System.out.println("Server has cleared the current status of the chat"); } @Override public void onCommandSecondLevelItemLostUpdates(int lostUpdates, String key) { //not on this subscription } @Override public void onCommandSecondLevelSubscriptionError(int code, String message, String key) { //not on this subscription } @Override public void onEndOfSnapshot(String arg0, int arg1) { System.out.println("Snapshot is now fully received, from now on only real-time messages will be received"); } @Override public void onItemLostUpdates(String itemName, int itemPos, int lostUpdates) { System.out.println(lostUpdates + " messages were lost"); } @Override public void onItemUpdate(ItemUpdate update) { System.out.println("====UPDATE====> " + update.getItemName()); System.out.println(update.getValue("BID")); System.out.println(update.getValue("OFFER")); System.out.println("<====UPDATE===="); } @Override public void onListenEnd() { System.out.println("Stop listeneing to subscription events"); } @Override public void onListenStart() { System.out.println("Start listeneing to subscription events"); } @Override public void onSubscription() { System.out.println("Now subscribed to the chat item, messages will now start coming in"); } @Override public void onSubscriptionError(int code, String message) { System.out.println("Cannot subscribe because of error " + code + ": " + message); } @Override public void onUnsubscription() { System.out.println("Now unsubscribed from chat item, no more messages will be received"); } @Override public void onRealMaxFrequency(String frequency) { System.out.println("Frequency is " + frequency); } }); client.subscribe(sub); client.connect();
×
×
  • Create New...
us