Lora<->Wifi Gateway and Threading

  • Hello. Starting from one of the official examples on how to set up a LoRa Nano-Gateway I am now trying to extend it so, that the 'receiver' part is also connected to the Internet via WiFi, and is able to forward packets received through the LoRa side, to the Internet.
    Such forwarding happens through a HTTP POST reuquest towards an existing data-collection server.

    My question is the following: since each HTTP request likely would take a couple of seconds, and would 'block' the rest of the server code (and notably, the While loop which continuosly checks for received packets from LoRa), what would be a best-practice approach to implement such gateway?
    What I want to achieve is that each individual LoRa node forwards packets to the nano-gateway, and only after the HTTP POST towards the data-collection server has been successful, an ACK is sent back to the node. But of course at the same time the nano-gateway must be able to receive new incoming packets from other existing nodes.

    I was thinking such task could be rather easy perhaps spawning a thread on the nano-gateway each time that a valid LoRa packet is received, and handle the HTTP request within that thread, and only at each thread termination, an ACK can be sent back to the LoRa node, but I'm not quite sure if this would be a viable approach, on a limited hardware.

    I appreciate any form of input coming from more experienced people.

Pycom on Twitter