Chunked messaging flow
Hey guys, I was wondering wondering if chunked messaging was ever considered for
@plasmohq/messaging
, or if it is part of the roadmap.
A few months ago when experimenting with the native chrome.runtime messaging API, I've found that if you're trying to send a large message to the background, it fails to do so.
I've solved this in the ArConnect extension by having multiple messages with chunks of the data i'm sending, but I'm wondering if a native support for this, built into the messaging library was more appropriate.
The library could automatically decide, if a message needs to be send chunked or not. (Unfortunately I couldn't find any info in the chrome extension docs about the limit for messages).13 Replies
This sounds like a great suggestion @Marton thanks for bringing it up
Gave +1 Rep to @Marton
can you file an RFC on the framework repo, also is your chunking implemention source available for study? I did that before for audio signal processing but would love to see what technique you used for this
I wonder if we should separate the API or automatically chunk them tho :d
hmm good question @louis
will file the RFC asap
only thing is that for the chunks to work for sure, the message needs to be an object with some extra infos, such as the index of the chunk, or the qty of the total chunks
Yeah we can enforce string/serializable data only
And just json stringify then turn it into a buffer
so that we know how to reconstruct the object and know when the chunk stream ended
yeah
yeah
sounds good
What's the buffer size are you using to transfer?
wdym exactly?
like the limit
for the chrome message size?
Oh I mean the chunk size
1024/2048 etc..
ah yeah not sure
i'll check it
Hey @louis, I finally had time to work on the RFC. I also experimented and found that the max message size is
67108862 bytes
, but I'm unsure if this changes on machines with other architecture. Here's the RFC, I'll probably get started on working a PR tomorrow to speed up the process, so you don't have to work on this for us 😄
https://github.com/PlasmoHQ/plasmo/issues/524GitHub
[RFC] Automatic chunked messaging · Issue #524 · PlasmoHQ/plasmo
How do you envision this feature/change to look/work like? The new system would automatically split the message data into pieces that wouldn't reach the size limitation of the browser messaging...
Yo sounds awesome! BTW I meant to respond to this long ago but fell ill past 2 weeks xd
Haha no problem, hope you're feeling better. I am now working on this