-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
Description
When creating more than one reliable channel, we are getting
"Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'payload')".
at ReliableChannel.processIncomingMessage (reliable_channel.js:242:86)
at eval (reliable_channel.js:232:24)
at eval (subscription.js:128:26)
Expected Behavior
Create mutliple reliable channels without any issues
Steps to Reproduce
- Create 2 reliable channels:
const test = await wakuClient.join({name: "tester"});
const test2 = await wakuClient.join({name: "tester2"});
- Send a message
setTimeout(() => {
test2.sendMessage({text:"Hello"});
},5000)
- Error occurs
The join method looks like this:
const symKey = this._hexToUint8Array(await this._toSymHeyKey(secret));
const routingInfo = AutoShardingRoutingInfo.fromContentTopic(this.topic, DefaultNetworkConfig);
const encoder = createEncoderSymmetric({contentTopic: this.topic, symKey, routingInfo, ephemeral: true, sigPrivKey: this.ownKeys.bytes.privateKey});
const decoder = createDecoderSymmetric(this.topic, routingInfo, symKey);
const _wakuChannel = await ReliableChannel.create(this.lightNode, name, this.senderId, encoder, decoder);
...and the send method like this:
const protoMessage = this.dataPacket.create({
id: random(),
sender: this.senderId,
payload: new TextEncoder().encode(JSON.stringify(payload))
});
const serialisedMessage = this.dataPacket.encode(protoMessage).finish();
const messageId = _wakuChannel.send(serialisedMessage);
Everything works fine as long as we only have 1 active channel.
Metadata
Metadata
Assignees
Labels
No labels