Closed jcoopeky closed 1 year ago
Hello,
On Web platforms, Channels serialize as MessagePorts, which require cloning to cross Worker boundaries. Prior to 4.x, Squadron would inspect messages looking for non "base" types (strings, numbers, arrays...) and try to clone them, but this procedure adds some overhead especially when messages rely on large arrays for instance. So I decided to disable this mechanism by default.
It is possible to restore it with inspectRequest
/ inspectResponse
but here you should only need inspectRequest
.
Can you try this in your Worker:
Future<void> setChannel(Object channelInfo) =>
send(TestService.setChannelCommand, args: [channelInfo], inspectRequest: true);
That did it, everything works now. Thank you!
No problem 😀 closing this issue then!
I have been messing around with Squadron, and have to say I am very impressed, but I have run into an issue when attempting to pass
Channels
from one web worker to another.Example:
Not sure if this is an actual issue or just a user error on my part, but in either case, it would be nice to have some additional examples of how to send Channels between web workers, and how to use those Channels to pass data between workers.