๐ค Basics
Here is a look at how the migration process would look for you if you choose to migrate from Twilio to Dyte
Creating a Roomโ
Intuitively, a Room represents a virtual space where end-users communicate
โ Twilio Docs
The equivalent of โRoomsโ from Twilio in Dyte is โMeetingsโ.
-
In Twilio you create a room by calling the REST API https://www.twilio.com/docs/video/api/rooms-resource (or using a client library)
-
In Dyte you create a meeting by calling a similar REST API https://docs.dyte.io/api#/operations/create_meeting
Request
- You pass a
UniqueName
while creating a Room in Twilio There is no UniqueName equivalent in Dyte, you can optionally pass thetitle
of meeting if want - If you want the recording to start when participants join you use
RecordParticipantsOnConnect
while creating a Room The equivalent parameter in Dyte isrecord_on_start
MediaRegion
โgllโ is the default where Twilio decides the best region. In Dyte if you don't pass any region inpreferred_region
Dyte selects the best region automatically
Response
- In the response you get a
room_sid
in Twilio, you get ameeting_id
in Dyte
Twilio | Dyte |
---|---|
Room | Meeting |
Room SID | Meeting ID |
Generating the participant tokenโ
With Twilio you generate the JWT for the user on your own https://www.twilio.com/docs/video/tutorials/user-identity-access-tokens
const token = new AccessToken(twilioAccountSid, twilioApiKey, twilioApiSecret, {
identity: identity,
});
token.addGrant(videoGrant);
console.log(token.toJwt());
In Dyte, you make a REST API call to Add Participant API which returns authToken
.
Twilio | Dyte |
---|---|
Access Token | Authtoken |
Installationโ
Install the Dyte SDK.
npm install @dytesdk/web-core
If you are using CDN / script tags install using
<script src="https://cdn.dyte.in/core/dyte.js" />
Now you can remove the Twilio SDK from your project by uninstalling the package.
npm uninstall twilio-video
Or if using the Twilio CDN script, remove the relevant script tag
Joining a Roomโ
Twilio
import * as TwilioVideo from 'twilio-video';
twilioRoom = await TwilioVideo.connect(TOKEN, {
name: 'yourName',
audio: false,
video: false,
dominantSpeaker: true,
});
Dyte
import DyteClient from '@dytesdk/web-core';
meeting = await DyteClient.init({ authToken: TOKEN });
await meeting.join();
Let's look at media next