connecting clients to mediaserver via webrtc

I have a video conferencing application which contains two servers 1) Main server which contains the business logic. 2) Media server (mediasoup). Basically clients connects to the main server via websockets. When they make a request for joining a room the request is first sent to the main server which checks if the user is allowed to join and after checking the permissions the main server send a message via rabbitmq to fetch the room info from the mediaserver. Now my main question is after doing all this how do i make a connection between client and mediaserver if the user has joined the room. I want to make a connection between client and mediserver via webrtc but i am unable to figure out how to do it. Its basically for my own project and i have searched a lot but i am unable to come up with a solution. Much appreciated

See this article for detailed usage instructions:

It’s well written - I used this and a mediasoup example app to build a client-server from scratch.

You’ll need to:

npm install mediasoup

To access the server API inside a Node.js app.

And:

npm install mediasoup-client

To create a mediasoup.js package to serve your clients so they can access the client side API.

PS. You don’t need to (and shouldn’t) use any WebRTC API to use mediasoup. It wraps all the WebRTC calls for you on both client and server sides.