How to send messages between addons?

Custom indicators, trading strategies, data export and recording and more...
blk
Posts: 44
Joined: Fri Nov 01, 2019 8:59 pm
Has thanked: 7 times

How to send messages between addons?

Post by blk » Thu May 06, 2021 2:24 am

Hi,

Is there an official way via the API to send messages between 2 different addons? I'm trying to avoid TCP calls as I'm using the Simplified API.

Thanks,
 

Svyatoslav
Site Admin
Posts: 183
Joined: Mon Jun 11, 2018 11:44 am
Has thanked: 2 times
Been thanked: 25 times

Re: How to send messages between addons?

Post by Svyatoslav » Thu May 06, 2021 11:56 am

Hi,
Yes, just use Layer1ApiUserInterModuleMessage. Send it down the stack, then catch it when it goes back up. You just need to subscribe to core API as Layer1ApiAdminListener using Api#getProvider#addListener

blk
Posts: 44
Joined: Fri Nov 01, 2019 8:59 pm
Has thanked: 7 times

Re: How to send messages between addons?

Post by blk » Thu May 06, 2021 3:39 pm

Hi,

Thanks for your reply. I was able to figure it out based on your message.
 

AndreyR
Posts: 409
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 17 times
Been thanked: 70 times

Re: How to send messages between addons?

Post by AndreyR » Fri May 07, 2021 8:08 am

Hi, for Core API you may implement the MessageListener interface to receive messages.

Post Reply