This project host a class with the same API of the
Remote Mediasoup client. It's
intended to be used for both testing purposes and as a testbed for the migration
of projects currently based on Mediasoup to use the
Remote Mediasoup client
instead. Behavior is mostly the same that the one
offered by the Remote Mediasoup client
instances, being the only two
differences:
Remote Mediasoup client mock
uses a local instance ofMediasoup
instead of connecting to an instance of Remote Mediasoup server- due to that,
Connection
WebSocket events are emulated instead of being real ones
npm install --save-dev @mafalda-sfu/remote-mediasoup-client-mock
See API documentation.
If you already have a Mediasoup
based project, to use
Remote Mediasoup client mock
on it you'll only need to do two changes in
your project code:
-
Replace the
mediasoup
import for@mafalda-sfu/remote-mediasoup-client-mock
:- import mediasoup from 'mediasoup' + import RemoteMediasoupClientMock from '@mafalda-sfu/remote-mediasoup-client-mock'
-
Create the instance of the
RemoteMediasoupClientMock
object, wait for itsconnected
event, and access to themediasoup
property:+ const remoteMediasoupClientMock = new RemoteMediasoupClientMock + + await once(remoteMediasoupClientMock, 'connected') + + const {mediasoup} = remoteMediasoupClientMock
After that, the mediasoup
variable will have an object that's API compatible
with the Mediasoup API
provided by the Mediasoup
package.