Hello everyone,
Thanks to miker2069, I am using the https://www.b4x.com/android/forum/t...and-video-streaming-updated-with-code.110131/. to transfer an image from the ESP32 camera to the host server through MQTT. The ESP32 sends checks of bytes, the server receives them, and stores them in a file on the server. Using the following code
The problem is that the MQTT gets disconnected from time to time. Is it possible to send chunks of bytes using a WebSocket client ( https://www.b4x.com/android/forum/threads/websocketclient.66212/#content )? I tried using the WebSocket to send chunks of images as bytes, but it did not work. The WebSocket expects strings, so I tried converting the byte to a string, but it did not work. Does anyone have any suggestions or examples to share? Thank you in advance
Thanks to miker2069, I am using the https://www.b4x.com/android/forum/t...and-video-streaming-updated-with-code.110131/. to transfer an image from the ESP32 camera to the host server through MQTT. The ESP32 sends checks of bytes, the server receives them, and stores them in a file on the server. Using the following code
Mqtt sending image:
For i = 0 To (num_chunks - 1)
ESP32CAM.byte_offset = i * chunk_size
ESP32CAM.MoveFrameBufferPtr
TotalLength=TotalLength+ESP32CAM.buffer.Length
Next
'Log("this total lenght of image",TotalLength)
'Log("Before publish pic")
mqtt.BeginPublish(JoinStrings(Array As String("Server/",DeviceID,"/",bc.StringFromBytes(GlobalStore.Slot0),"/Camera/Image")),TotalLength, False)
For i = 0 To (num_chunks - 1)
ESP32CAM.byte_offset = i * chunk_size
ESP32CAM.MoveFrameBufferPtr
'
'TotalLength=TotalLength+ESP32CAM.buffer.Length
'Log("This for mqtt ",ESP32CAM.buffer.Length)
'
'
mqtt.WriteChunk(ESP32CAM.buffer)
Next
'
mqtt.EndPublish
The problem is that the MQTT gets disconnected from time to time. Is it possible to send chunks of bytes using a WebSocket client ( https://www.b4x.com/android/forum/threads/websocketclient.66212/#content )? I tried using the WebSocket to send chunks of images as bytes, but it did not work. The WebSocket expects strings, so I tried converting the byte to a string, but it did not work. Does anyone have any suggestions or examples to share? Thank you in advance