KrosAI Docs
DashboardGet Started
  • Getting Started
    • Introduction
    • Quickstart Guide
    • Authentication
  • OpenAI SDK Compatability
  • Endpoints
    • Completions API
      • Create Chat Completion
    • Translation API
    • Text Summarization API
    • Audio Transcription API
    • Sentiment Analysis API
  • AGENT
    • Agents API
      • Create Agent
      • List Agents
      • Get Agent
      • Update Agent
      • Delete Agent
      • Start Voice Session
    • Conversations API
      • Create Conversation
      • List Conversations
      • Get Conversation
      • Get Conversation Messages
    • Knowledge Base API
      • Create Knowledge Base
      • List Knowledge Base
      • Upload Document
      • List Document
  • Resources
    • AI Voice Agents
    • In-App Voice Assistants
    • Virtual Health Assistants
    • EdTech Language Tutors
  • SDKS
    • Node.JS SDK
    • React Native SDK
    • Flutter
Powered by GitBook
On this page
  • 🚀 Installation
  • 🛠️ Usage
  • 📅 Components
  • ✨ Features
  • ⚡ Requirements
  1. SDKS

React Native SDK

A customizable WebRTC SDK for React Native that supports Expo. This package provides components for building real-time audio applications with KrosAI in React Native.

🚀 Installation

Install required dependencies:

npm install krosai-react-native-sdk react-native-webrtc expo-av expo-permissions @react-native-async-storage/async-storage

For Expo projects, configure the necessary permissions in your app.json:

{
  "expo": {
    "plugins": [
      [
        "expo-av",
        {
          "microphonePermission": "Allow $(PRODUCT_NAME) to access your microphone."
        }
      ]
    ]
  }
}

🛠️ Usage

Basic Example

import { VoiceAssistant } from 'krosai-react-native-sdk';

const App = () => {
  return (
    <VoiceAssistant
      url="wss://your-krosai-server.com"
      token="your-jwt-token"
      onMessage={(message) => {
        console.log('Received message:', message);
      }}
    />
  );
};

📅 Components

⛰️ KrosaiWrapper

The base wrapper component that manages WebRTC connection and audio setup.

Props:

  • url: string – Krosai WebSocket server URL

  • token: string – JWT token for authentication

  • onConnected?: () => void – Callback when successfully connected

  • onDisconnected?: () => void – Callback when disconnected

  • onError?: (error: Error) => void – Callback for connection errors

  • style?: ViewStyle – Custom styles for the container


🗣️ VoiceAssistant

A higher-level component that adds voice assistant functionality.

Props:

  • url: string – Krosai WebSocket server URL

  • token: string – JWT token for authentication

  • onMessage: (message: string) => void – Callback for received messages

  • style?: ViewStyle – Custom styles for the container


✨ Features

  • Expo compatibility

  • Audio permission handling

  • Mute/unmute functionality

  • Real-time message handling

  • Customizable styling

  • TypeScript support


⚡ Requirements

  • React Native v0.73.2 or higher

  • Expo SDK 50 or higher

  • iOS 13.0+

  • Android 5.0+

PreviousNode.JS SDKNextFlutter

Last updated 1 month ago