[Answered ]-How to send message from django server to a nodejs server and receive the reply?

2👍

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.

  1. Easiest way: Send list of items to nodeJs server from the web
    page, process data and send result to webserver using
    websockets/long polling or just hit server every n second while
    data not ready and send back to user same way.
  2. Good way(for me) make api by Node js, communicate with nodeJs by
    RestApi(idea exactly like in 3th approach by use http).
  3. 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.

Leave a comment