Problem with streamId of sctp

I have a problem with streamId in sctpStreamParameters. It’s always set to 0 by the produceData() in server-side. According to the docs, it can be set in the input params of this function, but doing so doesn’t have any effect. Looking at the demo code didn’t help either.

Here is the actual problem:
I create a data producer per user with associated data consumers for other users (just like the demo). The code works fine for two users. However, when a third user joins, both firefox and chorme throw error (firefox’s error is “id is in use”) while creating new data consumer. After debugging mediasoup-client, I think the streamId of data producer eventually ends up as the id of createDataChannel options. Probably I’m doing or understanding something completely wrong but I haven’t been able to find the issue.

Never mind. It was a bug in my code caused by a race condition in creating data consumers.