Publish data not displaying 1024 bytes, or not publishing 1024 bytes

Problem

As seen in the documentation on this page it says that the device OS 3.0.0 or greater has a publish limit of 1024 bytes, however when attempting to use this buffer to that limit i run into json being truncated as seen in the screenshots section below

It should also be noted that I can be sure of the buffer size by calling particle::protocol::MAX_EVENT_DATA_LENGTH from the firmware, which does in fact return 1024.

I believe this issue to be in relation to the JSONBufferWriter class, as I have been using it in this firmware, and can get successful publishes of 1024 bytes without truncation, however, when I begin to use the JSONBufferWriter class truncation resumes

Screenshots

Data as seen from Serial.println(publishBuffer)

publishBuffer is of type char[1024]

Data as returned on console.particle.io

{
	"publishes": "are",
	"being": "cut",
	"off!": [
		["example", "example", "example"],
		["example", "example", "example"],
		["example", "example", "example"],
		["example", "example", "example"],
		["example", "example", "example"],
		["example", "example", "example"],
		["example", "example", "example"],
		["example", "example", "example"],
		["example", "example", "example"],
		["example", "example", "example"],
		["example", "example", "example"],
		["example", "example", "example"],
		["example", "example", "example"],
		["example", "example", "example"],
		["example", "example", "example"],
		["example", "example", "example"],
		["example", "example", "example"],
		["example", "example", "example"],
		["example", "example", "example"],
		["example", "example", "example"�

Device information

Device: B402 Bsom
OS version: 3.0.0

Question

I am using the PublishQueueAsyncRK but upon inspecting that library it seems that it is using standard Particle.publish() at its core, I am wondering if I misinterpreted the documentation or if this is a bug.

Thanks in advance, Ozzie

1 Like

I am certain that this is not a cloud issue, as I can publish fine without the JSONBufferWriter class, but this is an issue with that class.

I released version 0.2.5 of PublishQueueAsyncRK. It changes how the maximum event buffer size is calculated.

0.2.5 (2021-07-26)

  • Use particle::protocol::MAX_EVENT_DATA_LENGTH instead of 623 as the maximum publish size.

Correct, I have established through my own testing that your queue library is not the issue, I believe it to be the JSONBufferWriter, I can use PublishQueueAsyncRK with a 1024b buffer no problem, but once I get the JSONBufferWriter involved that’s when they begin to truncate

I can create a firmware that will use the JSONBufferWriter class on the argon firmware and publish up to 1kB of data no problem, however when using the same firmware on the BSOM I get the issue of the truncated data.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.