here is a background of what i am trying to achieve here, i am trying to create routers on fly as needed, my problem here is when the newly created router, when i try to pipeToRouter to the producer no errors. its seems all goes through correctly, but when running canconsume it gives an error saying cannot fine the producerId (all previous routers are working as it should), so my question here is do i need to redo the produce the producer or have i missed something here,
any help would be awesome, i hope i have explained my situation clear enough
It seems that either you are not piping the producer properly to the new router or you are calling canconsume on the wrong router. You may have to share some code to see the actual problem.
cheers for the quick reply here @zaidiqbal thats what i am thinking too, just one thing i am not 100% sure is, since the relay is connected on this consumer server already, do i need to do the whole process again like connect pipe thing. coz what i am doing right now is just pipetoRouter
cheers again
Lets say you have producer_1 on router_1 and you need to create new router router_2 and producer the producer_1 from router_1 to router_2 and consume producer_1 from router_2 then these are the basic steps:
Create router router_2
do router_1.pipeToRouter() and pass the producer_1 id, router_2 id and other params.
do router_2.canConsume() pass producer_1 id, note that this id might be changed now for router_2 because thats a separate producer for router_2 I think you are passing router_1’s producer id to router_2.canconsume() which causes issues.
ok got ya man thanks for this, i think i missed a whole part here, thats why its not there, sounds like i can’t just try to pick it out from a stored array, the whole thing need to be done like from the first step, trying to jump the gun a little here, thanks i will give it a shot, will report back if it works out,
but this is a tricky one to fix i think, like the array is all there, but all the sudden a new router is created, producerId is changed, any suggestions of how to tackle this
Yes that’s tricky, the way i have handled it is that for every router I have maintained it’s producer ids array and then I also have named the producers as well and I have an object which maps producer name to producer id per router. Producer name is something like this user_1_camera_stream_producer.
Whenever i need to consume the producer I don’t send it’s actual id to server i just send it’s name to server from client side. And server then finds the correct producer id from the name from the object which I mentioned above.
It is up to you how you handle it but the way i described is working great for me.