Reputation: 481
Actually on the django server I have my website server running and on the nodejs server there is a bot which is running. I want my website to communicate with the bot forth and back. How can I achieve this? (for example: my bot accepts a trade given a list of items match to that trade and my website provides that list. So when I click a button my website will send the list to the bot and the bot will operate using that list)
Upvotes: 1
Views: 737
Reputation: 2606
You can use http and websockets like @avril-lavigne said but for me best way to use Message queue (MQ) for example https://redis.io
since it has pub\sub implememtation or maybe best for you zeromq.
n
second while
data not ready and send back to user same way.Hard way: In django you need create a task(your items with uniq id to indentify) to put the task to any storage (redis, your DB), send that task_id to web_page.
In that time in nodeJs make a waiter which will wait for the task, process the data and put to storage.
So you have task_id in browser client and ready data in storage. Now doing exactly same like in step 1 - hit every n second/* server to check if the task is complicated.
Upvotes: 2