@mirrorange/realtimekit-react-native
v0.2.1
Published
Cloudflare RealtimeKit SDK for react native
Readme
Table of Contents
About The Project
The core SDK provides RealtimeKit's core functionality, while letting a developer build a custom UI over it.
Built With
Installation
- Install NPM packages
npm install @cloudflare/realtimekit-react-native @stream-io/react-native-webrtc @config-plugins/react-native-webrtcNote: For platform specific installation instructions, please refer to the Documentation.
Usage
A meeting object can be created using the useRealtimeKitClient() hook.
import React from 'react';
import { useRealtimeKitClient, RealtimeKitProvider } from '@cloudflare/realtimekit-react-native';
export default function App() {
const [meeting, initMeeting] = useRealtimeKitClient();
React.useEffect(() => {
const init = async () => {
const meetingOptions = {
audio: true,
video: true,
};
await initMeeting({
authToken: 'YourAuthToken',
defaults: meetingOptions,
});
};
init();
if (meeting) meeting.joinRoom();
}, []);
if (meeting)
return (
<RealtimeKitProvider value={meeting}>
{/* Render you Components here*/}
{/* Components rendered inside RealtimeKitProvider can access RealtimeKitClient object using useRealtimeKitMeeting() hook */}
</RealtimeKitProvider>
);
}The meeting object is used for all interaction with Cloudflare's servers. For example, the following code snippet is used for a user to join a room.
await meeting.joinRoom();For more examples, please refer to the Documentation.
About
@cloudflare/realtimekit-react-native is created & maintained by Cloudflare, Inc.
The names and logos for Cloudflare are trademarks of Cloudflare, Inc.
