Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Socket Server Channel
 Post subject: Socket Server Channel Post rating: 0   New post Posted: Mon 29 May, 2017, 17:25 

User rating: 0
Joined: Mon 29 May, 2017, 17:19
Posts: 21
Location: Germany,
I have some trouble getting the Socket Server to send messages on it's own.

I am using the demo code there: https://www.dukascopy.com/wiki/en/devel ... et-channel

The thing is, this code waits for a string, then executes code that matches that string. Then it sends an answer back. But I am trying to get the server to send messages on its own, instead of reacting to an incoming string.
For example, onTick() gets called, and I would like to send a message containing the tick details.

This is my non-working code:
    public void onTick(Instrument instrument, ITick tick) throws JFException {
       final String message;
       message = "instrument"+instrument+": "+tick;
          context.executeTask(new ClientTask(message, key));

    }


There is no key so the code fails. What do I need to do? How do I get a new key?


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com