• Esprusino on ESP32, I write some codes to transfer data from serial port to a websocket server(nodejs). I use 'ws' module to transfer the data. The Serial2 is set to baudrate 115200, In ten seconds, about 23KB data will be received by Serial2 port. The Serial2.on('data', ...) returns about 230 bytes datas each time. In Serial2.on('data', ...) , I want to transfer the received data (about 230 bytes) to the server by ws.send(), but this will halt the program(the program no responsing). If I cache the 230 bytes to a string or a array until all the 23KB data are received, then send the data by ws.send(), it will take about 120 seconds to trasnsfer them to the server.
    I try the work with 'net' module, I can transfer 230bytes data in Serial2.on('data', ...) directly, without cacheing.
    Then I try the wok with a websocket module written in c++ in arduino-esp32, I can transfer 230bytes data in Serial2.on('data', ...) directly(without cacheing) too.

    How to fast the data transfer rate with 'ws' module in Esrpuino?

About

Avatar for Aifer @Aifer started