Skip to main content

๐Ÿ”ค 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โ€.

Request

  • You pass a UniqueName while creating a Room in Twilio There is no UniqueName equivalent in Dyte, you can optionally pass the title 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 is record_on_start
  • MediaRegion โ€gllโ€ is the default where Twilio decides the best region. In Dyte if you don't pass any region in preferred_region Dyte selects the best region automatically

Response

  • In the response you get a room_sid in Twilio, you get a meeting_id in Dyte
TwilioDyte
RoomMeeting
Room SIDMeeting 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.

TwilioDyte
Access TokenAuthtoken

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