לאפליקציות
שיחות וידאו לאפליקציה שלכם
API ו-SDK לשיחות וידאו עבור Next.js, Laravel, Django וכל stack אחר. שיחות בין שני אנשים מצלצלות בכל לשונית ואפליקציה של מי שמתקשרים אליו, תמיד מתחברות ומוצפנות מקצה לקצה, ומסך השיחה מוכן לשימוש, כך שאין לכם מה להפעיל.
או נסו את ההדגמה החיה: פתחו אותה בשני דפדפנים והתקשרו מאחד לשני.
התמחור הטוב ביותר ל-WebSockets, שיחות אחד על אחד ללא הגבלה עם שרתי TURN ברחבי העולם, ושיחות קבוצתיות ושידור חי עם מכסה כלולה. החל מ-$11.99 לחודש עבור 1,000 חיבורים בו-זמניים, בחיוב שנתי, או $14.99 בחיוב חודשי.
שיחות קבוצתיות מעבר לתוכנית שלכם: $0.20 לכל 1,000 דקות, $0.10 באודיו.
Next.js בשרת ו-React בדף.
export async function GET( request: Request ) {
const me = await currentUserId();
const ask = new URL( request.url ).searchParams;
const to = ask.get( 'to' )!;
// Your own check, whatever your app needs.
if ( ! me || ! await mayCall( me, to ) ) {
return new Response( null, { status: 403 } );
}
const token = await realtime.callToken( me, to, {
type: ask.get( 'type' ),
} );
return Response.json( { token } );
}app.get( '/api/call-token', async ( req, res ) => {
const me = userOf( req );
const { to, type } = req.query;
// Your own check, whatever your app needs.
if ( ! me || ! await mayCall( me, to ) ) {
return res.sendStatus( 403 );
}
const token = await realtime.callToken( me, to, { type } );
res.json( { token } );
} );import { createServer } from 'node:http';
createServer( async ( req, res ) => {
const url = new URL( req.url, 'http://localhost' );
if ( url.pathname === '/api/call-token' ) {
const me = userOf( req );
const to = url.searchParams.get( 'to' );
// Your own check, whatever your app needs.
if ( ! me || ! await mayCall( me, to ) ) {
res.writeHead( 403 );
return res.end();
}
const token = await realtime.callToken( me, to, {
type: url.searchParams.get( 'type' ),
} );
res.writeHead( 200, { 'Content-Type': 'application/json' } );
return res.end( JSON.stringify( { token } ) );
}
// Your pages, and realtime.node( userOf ) for the SDK's routes.
} ).listen( 3000 );use Illuminate\Http\Request;
use WordPlus\Realtime\Laravel\Facades\Realtime;
Route::get( '/api/call-token', function ( Request $request ) {
$me = $request->user()->id;
$to = $request->query( 'to' );
// Your own check, whatever your app needs.
abort_unless( may_call( $me, $to ), 403 );
return [ 'token' => Realtime::callToken( $me, $to, [
'type' => $request->query( 'type' ),
] ) ];
} )->middleware( 'auth' );require __DIR__ . '/../src/realtime.php';
$me = current_user_id();
$to = $_GET['to'] ?? '';
// Your own check, whatever your app needs.
if ( ! $me || ! may_call( $me, $to ) ) {
http_response_code( 403 );
exit;
}
header( 'Content-Type: application/json' );
echo json_encode( [
'token' => $realtime->callToken( $me, $to, [
'type' => $_GET['type'] ?? null,
] ),
] );from django.contrib.auth.decorators import login_required
from django.http import HttpResponseForbidden, JsonResponse
from .realtime import realtime
# In urls.py: path("api/call-token", views.call_token)
@login_required
def call_token(request):
me = request.user.id
to = request.GET["to"]
# Your own check, whatever your app needs.
if not may_call(me, to):
return HttpResponseForbidden()
token = realtime.call_token(me, to, type=request.GET.get("type"))
return JsonResponse({"token": token})from fastapi import Depends, HTTPException
from realtime import realtime
@app.get("/api/call-token")
def call_token(
to: str,
type: str = "video",
me: int = Depends(current_user_id),
):
# Your own check, whatever your app needs.
if not me or not may_call(me, to):
raise HTTPException(403)
return {"token": realtime.call_token(me, to, type=type)}from flask import abort, request, session
from realtime import realtime
@app.get("/api/call-token")
def call_token():
me = session.get("user_id")
to = request.args["to"]
# Your own check, whatever your app needs.
if not me or not may_call(me, to):
abort(403)
kind = request.args.get("type")
return {"token": realtime.call_token(me, to, type=kind)}// http.HandleFunc("GET /api/call-token", callToken)
func callToken(w http.ResponseWriter, r *http.Request) {
me := userOf(r)
to := r.URL.Query().Get("to")
// Your own check, whatever your app needs.
if me == "" || !mayCall(me, to) {
w.WriteHeader(403)
return
}
kind := r.URL.Query().Get("type")
reply(w, map[string]string{
"token": app.CallToken(me, to, kind, profile(me)),
})
}Hooks ורכיבים לכל אפליקציית React, עם כל אחד מהשרתים למעלה.
import { connect } from '@wordplus/realtime';
const rt = await connect();
// The ring and the call window.
await rt.callScreen();
// And in the page:
// <call-button to="34" token-url="/api/call-token"
// type="video" name="Ann">
// Call Ann
// </call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The ring and the call window.
await rt.callScreen();
// And in the page:
// <call-button to="34" token-url="/api/call-token"
// type="video" name="Ann">
// Call Ann
// </call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The ring and the call window.
await rt.callScreen();
// And in the page:
// <call-button to="34" token-url="/api/call-token"
// type="video" name="Ann">
// Call Ann
// </call-button>import { connect } from '@wordplus/realtime';
const rt = await connect( window.wordplusRealtimeConfig );
// The ring and the call window.
await rt.callScreen();
// And in the page:
// <call-button to="34" token-url="/api/call-token"
// type="video" name="Ann">
// Call Ann
// </call-button><call-button to="34" token-url="/api/call-token"
type="video" name="Ann">
Call Ann
</call-button>
<script type="module">
import { connect } from '@wordplus/realtime';
const rt = await connect( window.wordplusRealtimeConfig );
// The ring and the call window.
await rt.callScreen();
</script><call-button to="34" token-url="/api/call-token"
type="video" name="Ann">
Call Ann
</call-button>
<script type="module">
import { connect } from '@wordplus/realtime';
const rt = await connect( window.wordplusRealtimeConfig );
// The ring and the call window.
await rt.callScreen();
</script><call-button to="34" token-url="/api/call-token"
type="video" name="Ann">
Call Ann
</call-button>
<script type="module">
import { connect } from '@wordplus/realtime';
const rt = await connect( window.wordplusRealtimeConfig );
// The ring and the call window.
await rt.callScreen();
</script><call-button to="34" token-url="/api/call-token"
type="video" name="Ann">
Call Ann
</call-button>
<script type="module">
import { connect } from '@wordplus/realtime';
const rt = await connect( window.wordplusRealtimeConfig );
// The ring and the call window.
await rt.callScreen();
</script>import { connect } from '@wordplus/realtime';
const settings = await fetch( '/api/realtime/config' );
const rt = await connect( await settings.json() );
// The ring and the call window.
await rt.callScreen();
// And in the page:
// <call-button to="34" token-url="/api/call-token"
// type="video" name="Ann">
// Call Ann
// </call-button><call-button to="34" token-url="/api/call-token"
type="video" name="Ann">
Call Ann
</call-button>
<script type="module">
// The ring and the call window.
await window.Echo.connector.rt.callScreen();
</script>'use client'; // in Next.js
import { CallButton, CallScreen } from '@wordplus/realtime/react';
// Inside <RealtimeProvider>, once for the whole app.
export function CallAnn() {
return (
<>
<CallScreen />
<CallButton to={ 34 } tokenUrl="/api/call-token"
type="video" name="Ann">
Call Ann
</CallButton>
</>
);
}<script setup>
import { onMounted } from 'vue';
// realtime.js, one connection for the whole app:
// export const realtime = connect();
import { realtime } from './realtime';
onMounted( async () => {
// The ring and the call window.
( await realtime ).callScreen();
} );
</script>
<!-- isCustomElement for these tags, in vite.config.js -->
<template>
<call-button to="34" token-url="/api/call-token"
type="video" name="Ann">
Call Ann
</call-button>
</template><script>
import { onMount } from 'svelte';
// realtime.js, one connection for the whole app:
// export const realtime = connect();
import { realtime } from './realtime';
onMount( async () => {
// The ring and the call window.
( await realtime ).callScreen();
} );
</script>
<call-button to="34" token-url="/api/call-token"
type="video" name="Ann">
Call Ann
</call-button>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
// realtime.ts, one connection for the whole app:
// export const realtime = connect();
import { realtime } from './realtime';
@Component( {
selector: 'app-call-ann',
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
template: `
<call-button to="34" token-url="/api/call-token"
type="video" name="Ann">
Call Ann
</call-button>
`,
} )
export class CallAnnComponent {
async ngOnInit() {
// The ring and the call window.
( await realtime ).callScreen();
}
}import WordPlusRealtimeCalls
import WordPlusRealtimeUI
// Rings for every call coming in.
CallScreen.shared.attach(rt.calls)
// Your own request to your route.
let token = try await api.callToken(to: "34")
let call = try await rt.startCall(token)
CallScreen.shared.show(call, name: "Ann")import cloud.wordplus.realtime.calls.calls
import cloud.wordplus.realtime.calls.startCall
import cloud.wordplus.realtime.ui.CallScreen
// Rings for every call coming in.
CallScreen.attach(context, rt.calls(context))
// Your own request to your route.
val token = api.callToken(to = "34")
val call = rt.startCall(context, token)
CallScreen.show(context, call, name = "Ann")import {
CallButton, CallScreen, RealtimeProvider,
} from '@wordplus/realtime-react-native';
// Your server, in full, as an app has no address of its own.
const API = 'https://app.example.com/api';
const options = {
app: 's1500000007',
endpoint: API + '/realtime',
headers: { Authorization: 'Bearer ' + session.token },
};
export function App() {
return (
<RealtimeProvider options={ options }>
<CallScreen />
<CallButton to="34" tokenUrl={ API + '/call-token' }
type="video" name="Ann">
Call Ann
</CallButton>
</RealtimeProvider>
);
}import 'package:flutter/material.dart';
import 'package:wordplus_realtime/wordplus_realtime.dart';
// Your server, in full, as an app has no address of its own.
const api = 'https://app.example.com/api';
// Once, as your app starts.
final rt = await WordPlusRealtime.connect(
app: 's1500000007',
endpoint: '$api/realtime',
headers: {'Authorization': 'Bearer ${session.token}'},
);
// Rings for every call coming in, and shows it once answered.
await rt.callScreen();
// In your build:
CallButton(
rt: rt,
to: '34',
tokenUrl: '$api/call-token',
name: 'Ann',
child: const Text('Call Ann'),
)
נסו שיחת וידאו
התחילו כאן שיחה וענו לה מהטלפון או מחלון שני. לא צריך חשבון.
אלה המסכים שה-SDK נותן לאפליקציה שלכם. הדפדפן מבקש גישה למצלמה ולמיקרופון, שום דבר לא מוקלט, וההדגמה מסתיימת אחרי 10 דקות.
שיחות בין שני אנשים
כל שיחה מתחברת
שיחה מצלצלת בכל לשונית ואפליקציה שפתוחות אצל מי שמתקשרים אליו, ומפסיקה לצלצל בכולן ברגע שהוא עונה באחת מהן. אחר כך היא עוברת בדרך הטובה ביותר ששתי הרשתות מאפשרות, בלי שרת TURN שלכם לתחזק.
- ישירותבין שני המכשירים, ברוב הרשתות. הדרך המהירה ביותר.
- דרך הממסרים שלנוכשחומת אש חוסמת את הדרך הישירה. הם עונים בפורטים של הרשת, כך ששיחה עוברת בכל מקום שאתרים עוברים.
- דרך שרתי המדיה שלנוכשגם הממסרים לא מגיעים. השיחה עוברת לשם וממשיכה, בלי לנתק.
מוצפנות מקצה לקצה בכל דרך, וכלולות בכל תוכנית.
איפה השיחות מתחברות
הממסרים ושרתי המדיה שלנו פועלים קרוב למשתמשים שלכם, וכל שיחה עוברת דרך השרת הקרוב ביותר למשתתפים בה.
השרת שלכם מחליט
התחלה, מענה וניהול של שיחה
מי רשאי להתקשר למי תלוי באפליקציה שלכם. השרת שלכם נותן לדף אסימון לכל שיחה שהוא מאשר, והדף מתחיל איתו את השיחה, מכפתור או מהקוד שלכם. הנה שיחה אל Ann, משימה אחר משימה.
Next.js בשרת ו-React בדף.
מתן אסימון לדף
מי רשאי להתקשר למי נקבע בלוגיקה של האפליקציה שלכם, ולכן זה נמצא בנתיב משלכם. בדקו כל מה שהאפליקציה שלכם צריכה, ואז ענו באסימון. אסימון מתחיל שיחה אחת, ובלעדיו שום דבר לא מצלצל. mayCall היא בדיקה שלכם.
export async function GET( request: Request ) {
const me = await currentUserId();
const ask = new URL( request.url ).searchParams;
const to = ask.get( 'to' )!;
// Your own check, whatever your app needs.
if ( ! me || ! await mayCall( me, to ) ) {
return new Response( null, { status: 403 } );
}
const token = await realtime.callToken( me, to, {
type: ask.get( 'type' ),
} );
return Response.json( { token } );
}app.get( '/api/call-token', async ( req, res ) => {
const me = userOf( req );
const { to, type } = req.query;
// Your own check, whatever your app needs.
if ( ! me || ! await mayCall( me, to ) ) {
return res.sendStatus( 403 );
}
const token = await realtime.callToken( me, to, { type } );
res.json( { token } );
} );import { createServer } from 'node:http';
createServer( async ( req, res ) => {
const url = new URL( req.url, 'http://localhost' );
if ( url.pathname === '/api/call-token' ) {
const me = userOf( req );
const to = url.searchParams.get( 'to' );
// Your own check, whatever your app needs.
if ( ! me || ! await mayCall( me, to ) ) {
res.writeHead( 403 );
return res.end();
}
const token = await realtime.callToken( me, to, {
type: url.searchParams.get( 'type' ),
} );
res.writeHead( 200, { 'Content-Type': 'application/json' } );
return res.end( JSON.stringify( { token } ) );
}
// Your pages, and realtime.node( userOf ) for the SDK's routes.
} ).listen( 3000 );use Illuminate\Http\Request;
use WordPlus\Realtime\Laravel\Facades\Realtime;
Route::get( '/api/call-token', function ( Request $request ) {
$me = $request->user()->id;
$to = $request->query( 'to' );
// Your own check, whatever your app needs.
abort_unless( may_call( $me, $to ), 403 );
return [ 'token' => Realtime::callToken( $me, $to, [
'type' => $request->query( 'type' ),
] ) ];
} )->middleware( 'auth' );require __DIR__ . '/../src/realtime.php';
$me = current_user_id();
$to = $_GET['to'] ?? '';
// Your own check, whatever your app needs.
if ( ! $me || ! may_call( $me, $to ) ) {
http_response_code( 403 );
exit;
}
header( 'Content-Type: application/json' );
echo json_encode( [
'token' => $realtime->callToken( $me, $to, [
'type' => $_GET['type'] ?? null,
] ),
] );from django.contrib.auth.decorators import login_required
from django.http import HttpResponseForbidden, JsonResponse
from .realtime import realtime
# In urls.py: path("api/call-token", views.call_token)
@login_required
def call_token(request):
me = request.user.id
to = request.GET["to"]
# Your own check, whatever your app needs.
if not may_call(me, to):
return HttpResponseForbidden()
token = realtime.call_token(me, to, type=request.GET.get("type"))
return JsonResponse({"token": token})from fastapi import Depends, HTTPException
from realtime import realtime
@app.get("/api/call-token")
def call_token(
to: str,
type: str = "video",
me: int = Depends(current_user_id),
):
# Your own check, whatever your app needs.
if not me or not may_call(me, to):
raise HTTPException(403)
return {"token": realtime.call_token(me, to, type=type)}from flask import abort, request, session
from realtime import realtime
@app.get("/api/call-token")
def call_token():
me = session.get("user_id")
to = request.args["to"]
# Your own check, whatever your app needs.
if not me or not may_call(me, to):
abort(403)
kind = request.args.get("type")
return {"token": realtime.call_token(me, to, type=kind)}// http.HandleFunc("GET /api/call-token", callToken)
func callToken(w http.ResponseWriter, r *http.Request) {
me := userOf(r)
to := r.URL.Query().Get("to")
// Your own check, whatever your app needs.
if me == "" || !mayCall(me, to) {
w.WriteHeader(403)
return
}
kind := r.URL.Query().Get("type")
reply(w, map[string]string{
"token": app.CallToken(me, to, kind, profile(me)),
})
}הוספת כפתור שיחה
המסך המוכן: כפתור, הצלצול עם ענה ודחה, וחלון השיחה, בלי קוד שיחה. הכפתור מבקש את האסימון שלו מהנתיב שלכם. הפעילו את המסך בכל דף שאפשר להתקשר למישהו בו, כי שיחה מצלצלת רק איפה שהוא רץ.
Hooks ורכיבים לכל אפליקציית React, עם כל אחד מהשרתים למעלה.
import { connect } from '@wordplus/realtime';
const rt = await connect();
// The ring and the call window, on every page someone may be called on.
await rt.callScreen();
// And in the page. The button asks your route for its token.
// <call-button to="34" token-url="/api/call-token" type="video" name="Ann">
// Call Ann
// </call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The ring and the call window, on every page someone may be called on.
await rt.callScreen();
// And in the page. The button asks your route for its token.
// <call-button to="34" token-url="/api/call-token" type="video" name="Ann">
// Call Ann
// </call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The ring and the call window, on every page someone may be called on.
await rt.callScreen();
// And in the page. The button asks your route for its token.
// <call-button to="34" token-url="/api/call-token" type="video" name="Ann">
// Call Ann
// </call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The ring and the call window, on every page someone may be called on.
await rt.callScreen();
// And in the page. The button asks your route for its token.
// <call-button to="34" token-url="/api/call-token" type="video" name="Ann">
// Call Ann
// </call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The ring and the call window, on every page someone may be called on.
await rt.callScreen();
// And in the page. The button asks your route for its token.
// <call-button to="34" token-url="/api/call-token" type="video" name="Ann">
// Call Ann
// </call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The ring and the call window, on every page someone may be called on.
await rt.callScreen();
// And in the page. The button asks your route for its token.
// <call-button to="34" token-url="/api/call-token" type="video" name="Ann">
// Call Ann
// </call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The ring and the call window, on every page someone may be called on.
await rt.callScreen();
// And in the page. The button asks your route for its token.
// <call-button to="34" token-url="/api/call-token" type="video" name="Ann">
// Call Ann
// </call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The ring and the call window, on every page someone may be called on.
await rt.callScreen();
// And in the page. The button asks your route for its token.
// <call-button to="34" token-url="/api/call-token" type="video" name="Ann">
// Call Ann
// </call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The ring and the call window, on every page someone may be called on.
await rt.callScreen();
// And in the page. The button asks your route for its token.
// <call-button to="34" token-url="/api/call-token" type="video" name="Ann">
// Call Ann
// </call-button><call-button to="34" token-url="/api/call-token" type="video" name="Ann">
Call Ann
</call-button>
<script type="module">
// The ring and the call window, on every page someone may be called on.
await window.Echo.connector.rt.callScreen();
</script>'use client'; // in Next.js
import { CallButton, CallScreen } from '@wordplus/realtime/react';
// Inside <RealtimeProvider>, once for the whole app.
export function CallAnn() {
return (
<>
<CallScreen />
<CallButton to={ 34 } tokenUrl="/api/call-token" type="video" name="Ann">
Call Ann
</CallButton>
</>
);
}<script setup>
import { watchEffect } from 'vue';
import { useRealtime } from '@wordplus/realtime/vue';
// provideRealtime() once, in your root component.
const rt = useRealtime();
// The ring and the call window, on every page someone may be called on.
watchEffect( () => rt.value?.callScreen() );
</script>
<!-- isCustomElement for this tag, in vite.config.js -->
<template>
<call-button to="34" token-url="/api/call-token" type="video" name="Ann">
Call Ann
</call-button>
</template><script>
import { useRealtime } from '@wordplus/realtime/svelte';
// provideRealtime() once, in your root component.
const rt = useRealtime();
// The ring and the call window, on every page someone may be called on.
$effect( () => { rt.current?.callScreen(); } );
</script>
<call-button to="34" token-url="/api/call-token" type="video" name="Ann">
Call Ann
</call-button>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
// realtime.ts, one connection for the whole app:
// export const realtime = connect();
import { realtime } from './realtime';
@Component( {
selector: 'app-call-ann',
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
template: `<call-button to="34" token-url="/api/call-token" type="video" name="Ann">Call Ann</call-button>`,
} )
export class CallAnnComponent {
async ngOnInit() {
const rt = await realtime;
// The ring and the call window, on every page someone may be called on.
await rt.callScreen();
}
}import WordPlusRealtimeCalls
import WordPlusRealtimeUI
// Rings for every call coming in, and shows it once answered.
CallScreen.shared.attach(rt.calls)
let token = try await api.callToken(to: "34") // your own request to your route
let call = try await rt.startCall(token)
CallScreen.shared.show(call, name: "Ann")import cloud.wordplus.realtime.calls.calls
import cloud.wordplus.realtime.calls.startCall
import cloud.wordplus.realtime.ui.CallScreen
// Rings for every call coming in, and shows it once answered.
CallScreen.attach(context, rt.calls(context))
val token = api.callToken(to = "34") // your own request to your route
val call = rt.startCall(context, token)
CallScreen.show(context, call, name = "Ann")import {
CallButton, CallScreen, RealtimeProvider,
} from '@wordplus/realtime-react-native';
// Your server, in full, as an app has no address of its own.
const API = 'https://app.example.com/api';
const options = {
app: 's1500000007',
endpoint: API + '/realtime',
headers: { Authorization: 'Bearer ' + session.token },
};
export function App() {
return (
<RealtimeProvider options={ options }>
<CallScreen />
<CallButton to="34" tokenUrl={ API + '/call-token' }
type="video" name="Ann">
Call Ann
</CallButton>
</RealtimeProvider>
);
}import 'package:flutter/material.dart';
import 'package:wordplus_realtime/wordplus_realtime.dart';
// Your server, in full, as an app has no address of its own.
const api = 'https://app.example.com/api';
// Once, as your app starts.
final rt = await WordPlusRealtime.connect(
app: 's1500000007',
endpoint: '$api/realtime',
headers: {'Authorization': 'Bearer ${session.token}'},
);
// Rings for every call coming in, and shows it once answered.
await rt.callScreen();
// In your build:
CallButton(
rt: rt,
to: '34',
tokenUrl: '$api/call-token',
name: 'Ann',
child: const Text('Call Ann'),
)התקשרות מהקוד שלכם
למסך שאתם מציירים בעצמכם: קבלו אסימון מהנתיב שלכם, והתחילו איתו את השיחה. השיחה מצלצלת בכל לשונית ואפליקציה שפתוחות אצל האדם השני, ומפסיקה לצלצל בכולן ברגע שהוא עונה באחת מהן.
Hooks ורכיבים לכל אפליקציית React, עם כל אחד מהשרתים למעלה.
import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function callToken( to ) {
const answer = await fetch( '/api/call-token?to=' + to );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const call = await rt.startCall( await callToken( 34 ) );
call.on( 'state', ( state ) => showState( state ) ); // ringing, connecting, connected, ended
call.on( 'remote', () => {
call.remote.camera?.attach( video ); // a <video> of yours
call.remote.microphone?.attach( audio ); // an <audio> of yours
} );
await call.setMicrophone( true );
await call.setCamera( true );
hangUp.onclick = () => call.end();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function callToken( to ) {
const answer = await fetch( '/api/call-token?to=' + to );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const call = await rt.startCall( await callToken( 34 ) );
call.on( 'state', ( state ) => showState( state ) ); // ringing, connecting, connected, ended
call.on( 'remote', () => {
call.remote.camera?.attach( video ); // a <video> of yours
call.remote.microphone?.attach( audio ); // an <audio> of yours
} );
await call.setMicrophone( true );
await call.setCamera( true );
hangUp.onclick = () => call.end();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function callToken( to ) {
const answer = await fetch( '/api/call-token?to=' + to );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const call = await rt.startCall( await callToken( 34 ) );
call.on( 'state', ( state ) => showState( state ) ); // ringing, connecting, connected, ended
call.on( 'remote', () => {
call.remote.camera?.attach( video ); // a <video> of yours
call.remote.microphone?.attach( audio ); // an <audio> of yours
} );
await call.setMicrophone( true );
await call.setCamera( true );
hangUp.onclick = () => call.end();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function callToken( to ) {
const answer = await fetch( '/api/call-token?to=' + to );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const call = await rt.startCall( await callToken( 34 ) );
call.on( 'state', ( state ) => showState( state ) ); // ringing, connecting, connected, ended
call.on( 'remote', () => {
call.remote.camera?.attach( video ); // a <video> of yours
call.remote.microphone?.attach( audio ); // an <audio> of yours
} );
await call.setMicrophone( true );
await call.setCamera( true );
hangUp.onclick = () => call.end();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function callToken( to ) {
const answer = await fetch( '/api/call-token?to=' + to );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const call = await rt.startCall( await callToken( 34 ) );
call.on( 'state', ( state ) => showState( state ) ); // ringing, connecting, connected, ended
call.on( 'remote', () => {
call.remote.camera?.attach( video ); // a <video> of yours
call.remote.microphone?.attach( audio ); // an <audio> of yours
} );
await call.setMicrophone( true );
await call.setCamera( true );
hangUp.onclick = () => call.end();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function callToken( to ) {
const answer = await fetch( '/api/call-token?to=' + to );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const call = await rt.startCall( await callToken( 34 ) );
call.on( 'state', ( state ) => showState( state ) ); // ringing, connecting, connected, ended
call.on( 'remote', () => {
call.remote.camera?.attach( video ); // a <video> of yours
call.remote.microphone?.attach( audio ); // an <audio> of yours
} );
await call.setMicrophone( true );
await call.setCamera( true );
hangUp.onclick = () => call.end();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function callToken( to ) {
const answer = await fetch( '/api/call-token?to=' + to );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const call = await rt.startCall( await callToken( 34 ) );
call.on( 'state', ( state ) => showState( state ) ); // ringing, connecting, connected, ended
call.on( 'remote', () => {
call.remote.camera?.attach( video ); // a <video> of yours
call.remote.microphone?.attach( audio ); // an <audio> of yours
} );
await call.setMicrophone( true );
await call.setCamera( true );
hangUp.onclick = () => call.end();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function callToken( to ) {
const answer = await fetch( '/api/call-token?to=' + to );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const call = await rt.startCall( await callToken( 34 ) );
call.on( 'state', ( state ) => showState( state ) ); // ringing, connecting, connected, ended
call.on( 'remote', () => {
call.remote.camera?.attach( video ); // a <video> of yours
call.remote.microphone?.attach( audio ); // an <audio> of yours
} );
await call.setMicrophone( true );
await call.setCamera( true );
hangUp.onclick = () => call.end();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function callToken( to ) {
const answer = await fetch( '/api/call-token?to=' + to );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const call = await rt.startCall( await callToken( 34 ) );
call.on( 'state', ( state ) => showState( state ) ); // ringing, connecting, connected, ended
call.on( 'remote', () => {
call.remote.camera?.attach( video ); // a <video> of yours
call.remote.microphone?.attach( audio ); // an <audio> of yours
} );
await call.setMicrophone( true );
await call.setCamera( true );
hangUp.onclick = () => call.end();const rt = window.Echo.connector.rt; // the connection Echo made
// Asks your server for a token: your route from the first step.
async function callToken( to ) {
const answer = await fetch( '/api/call-token?to=' + to );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const call = await rt.startCall( await callToken( 34 ) );
call.on( 'state', ( state ) => showState( state ) ); // ringing, connecting, connected, ended
call.on( 'remote', () => {
call.remote.camera?.attach( video ); // a <video> of yours
call.remote.microphone?.attach( audio ); // an <audio> of yours
} );
await call.setMicrophone( true );
await call.setCamera( true );
hangUp.onclick = () => call.end();'use client'; // in Next.js
import { AudioTrack, useCall, VideoTrack } from '@wordplus/realtime/react';
// Asks your server for a token: your route from the first step.
async function callToken( to ) {
const answer = await fetch( '/api/call-token?to=' + to );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
// Inside <RealtimeProvider>, once for the whole app.
export function Call() {
const { call, state, remote, camera, start, end } = useCall();
if ( ! call ) {
return <button onClick={ async () => start( await callToken( 34 ) ) }>Call Ann</button>;
}
return (
<>
<p>{ state }</p>
<VideoTrack track={ remote?.camera } />
<AudioTrack track={ remote?.microphone } />
<VideoTrack track={ camera } />
<button onClick={ end }>Hang up</button>
</>
);
}<script setup>
import { AudioTrack, useCall, VideoTrack } from '@wordplus/realtime/vue';
// Asks your server for a token: your route from the first step.
async function callToken( to ) {
const answer = await fetch( '/api/call-token?to=' + to );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
// provideRealtime() once, in your root component.
const { call, state, remote, camera, start, end } = useCall();
</script>
<template>
<button v-if="! call" @click="async () => start( await callToken( 34 ) )">Call Ann</button>
<template v-else>
<p>{{ state }}</p>
<VideoTrack :track="remote?.camera" />
<AudioTrack :track="remote?.microphone" />
<VideoTrack :track="camera" />
<button @click="end">Hang up</button>
</template>
</template><script>
import { track, useCall } from '@wordplus/realtime/svelte';
// Asks your server for a token: your route from the first step.
async function callToken( to ) {
const answer = await fetch( '/api/call-token?to=' + to );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
// provideRealtime() once, in your root component.
const current = useCall();
</script>
{#if ! current.call}
<button onclick={ async () => current.start( await callToken( 34 ) ) }>Call Ann</button>
{:else}
<p>{ current.state }</p>
<video use:track={ current.remote?.camera } muted autoplay playsinline></video>
<audio use:track={ current.remote?.microphone } autoplay></audio>
<video use:track={ current.camera } muted autoplay playsinline></video>
<button onclick={ current.end }>Hang up</button>
{/if}import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
// realtime.ts, one connection for the whole app:
// export const realtime = connect();
import { realtime } from './realtime';
@Component( {
selector: 'app-call',
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
template: `<video #video autoplay playsinline></video>`,
} )
export class CallComponent {
async ngOnInit() {
const rt = await realtime;
// Asks your server for a token: your route from the first step.
async function callToken( to ) {
const answer = await fetch( '/api/call-token?to=' + to );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const call = await rt.startCall( await callToken( 34 ) );
call.on( 'state', ( state ) => showState( state ) ); // ringing, connecting, connected, ended
call.on( 'remote', () => {
call.remote.camera?.attach( video ); // a <video> of yours
call.remote.microphone?.attach( audio ); // an <audio> of yours
} );
await call.setMicrophone( true );
await call.setCamera( true );
hangUp.onclick = () => call.end();
}
}let token = try await api.callToken(to: "34") // your own request to your route
let call = try await rt.startCall(token)
call.onState { state in label.text = state.rawValue } // ringing, connecting, connected, ended
call.onRemote { remoteView.show(call.remoteCamera) } // a CallVideoView of yours
ownView.show(call.localCamera)
hangUp.addAction(UIAction { _ in call.end() }, for: .touchUpInside)val token = api.callToken(to = "34") // your own request to your route
val call = rt.startCall(context, token)
call.onState { state -> label.text = state.wire } // ringing, connecting, connected, ended
call.onRemote { remoteView.show(call.remoteCamera) } // a CallVideoView of yours
ownView.show(call.localCamera)
hangUp.setOnClickListener { call.end() }import { Button, Text, View } from 'react-native';
import { CallVideo, useCall, useRealtime } from '@wordplus/realtime-react-native';
const API = 'https://app.example.com/api'; // your server, in full
// Inside <RealtimeProvider>, once for the whole app.
export function Call() {
const rt = useRealtime();
const { call, state, start, end } = useCall();
// Asks your route from the first step, then starts with its token.
const callAnn = async () => {
start( await rt.tokenFrom( API + '/call-token', { to: 34, type: 'video' } ) );
};
if ( ! call ) return <Button title="Call Ann" disabled={ ! rt } onPress={ callAnn } />;
return (
<View style={ { flex: 1 } }>
<Text>{ state?.state }</Text>
<CallVideo call={ call } style={ { flex: 1 } } />
<CallVideo call={ call } source="own" mirrored style={ { height: 120 } } />
<Button title="Hang up" onPress={ end } />
</View>
);
}// Asks your route from the first step, then starts with its token.
final token = await rt.tokenFrom('$api/call-token', {'to': 34, 'type': 'video'});
final call = await rt.startCall(token);
// ringing, connecting, connected, reconnecting, ended
call.onState((state) => showState(state));
// In your build, where you lay them out:
CallVideo(call: call) // the other side
CallVideo(call: call, source: CallVideoSource.own, mirrored: true) // your own
FilledButton(onPressed: call.end, child: const Text('Hang up'))מענה לשיחה
דף שממתין לשיחות מחזיק את הקו של המשתמש שלו, שבו השיחות שלו מצלצלות במשך 45 שניות. כדי לענות לא צריך אסימון, כי האסימון של המתקשר כבר מראה שהשרת שלכם אמר כן. ענו או דחו, והלשוניות האחרות שלו מפסיקות לצלצל.
Hooks ורכיבים לכל אפליקציית React, עם כל אחד מהשרתים למעלה.
import { connect } from '@wordplus/realtime';
const rt = await connect();
// From now on their calls ring on this page.
rt.onIncomingCall( ( incoming ) => {
showRing( incoming.info?.name, incoming.type );
answer.onclick = () => incoming.accept(); // gives the call, as rt.startCall() does
decline.onclick = () => incoming.decline(); // or decline( 'busy' )
incoming.on( 'over', hideRing ); // answered elsewhere, or the caller gave up
} );import { connect } from '@wordplus/realtime';
const rt = await connect();
// From now on their calls ring on this page.
rt.onIncomingCall( ( incoming ) => {
showRing( incoming.info?.name, incoming.type );
answer.onclick = () => incoming.accept(); // gives the call, as rt.startCall() does
decline.onclick = () => incoming.decline(); // or decline( 'busy' )
incoming.on( 'over', hideRing ); // answered elsewhere, or the caller gave up
} );import { connect } from '@wordplus/realtime';
const rt = await connect();
// From now on their calls ring on this page.
rt.onIncomingCall( ( incoming ) => {
showRing( incoming.info?.name, incoming.type );
answer.onclick = () => incoming.accept(); // gives the call, as rt.startCall() does
decline.onclick = () => incoming.decline(); // or decline( 'busy' )
incoming.on( 'over', hideRing ); // answered elsewhere, or the caller gave up
} );import { connect } from '@wordplus/realtime';
const rt = await connect();
// From now on their calls ring on this page.
rt.onIncomingCall( ( incoming ) => {
showRing( incoming.info?.name, incoming.type );
answer.onclick = () => incoming.accept(); // gives the call, as rt.startCall() does
decline.onclick = () => incoming.decline(); // or decline( 'busy' )
incoming.on( 'over', hideRing ); // answered elsewhere, or the caller gave up
} );import { connect } from '@wordplus/realtime';
const rt = await connect();
// From now on their calls ring on this page.
rt.onIncomingCall( ( incoming ) => {
showRing( incoming.info?.name, incoming.type );
answer.onclick = () => incoming.accept(); // gives the call, as rt.startCall() does
decline.onclick = () => incoming.decline(); // or decline( 'busy' )
incoming.on( 'over', hideRing ); // answered elsewhere, or the caller gave up
} );import { connect } from '@wordplus/realtime';
const rt = await connect();
// From now on their calls ring on this page.
rt.onIncomingCall( ( incoming ) => {
showRing( incoming.info?.name, incoming.type );
answer.onclick = () => incoming.accept(); // gives the call, as rt.startCall() does
decline.onclick = () => incoming.decline(); // or decline( 'busy' )
incoming.on( 'over', hideRing ); // answered elsewhere, or the caller gave up
} );import { connect } from '@wordplus/realtime';
const rt = await connect();
// From now on their calls ring on this page.
rt.onIncomingCall( ( incoming ) => {
showRing( incoming.info?.name, incoming.type );
answer.onclick = () => incoming.accept(); // gives the call, as rt.startCall() does
decline.onclick = () => incoming.decline(); // or decline( 'busy' )
incoming.on( 'over', hideRing ); // answered elsewhere, or the caller gave up
} );import { connect } from '@wordplus/realtime';
const rt = await connect();
// From now on their calls ring on this page.
rt.onIncomingCall( ( incoming ) => {
showRing( incoming.info?.name, incoming.type );
answer.onclick = () => incoming.accept(); // gives the call, as rt.startCall() does
decline.onclick = () => incoming.decline(); // or decline( 'busy' )
incoming.on( 'over', hideRing ); // answered elsewhere, or the caller gave up
} );import { connect } from '@wordplus/realtime';
const rt = await connect();
// From now on their calls ring on this page.
rt.onIncomingCall( ( incoming ) => {
showRing( incoming.info?.name, incoming.type );
answer.onclick = () => incoming.accept(); // gives the call, as rt.startCall() does
decline.onclick = () => incoming.decline(); // or decline( 'busy' )
incoming.on( 'over', hideRing ); // answered elsewhere, or the caller gave up
} );const rt = window.Echo.connector.rt; // the connection Echo made
// From now on their calls ring on this page.
rt.onIncomingCall( ( incoming ) => {
showRing( incoming.info?.name, incoming.type );
answer.onclick = () => incoming.accept(); // gives the call, as rt.startCall() does
decline.onclick = () => incoming.decline(); // or decline( 'busy' )
incoming.on( 'over', hideRing ); // answered elsewhere, or the caller gave up
} );// In the component that holds the call, on the same useCall().
const { incoming } = useCalls(); // those ringing now
const ring = incoming[ 0 ];
if ( ! call && ring ) {
return (
<>
<p>{ ring.info?.name } is calling</p>
<button onClick={ () => answer( ring ) }>Answer</button>
<button onClick={ () => ring.decline() }>Decline</button>
</>
);
}<script setup>
// In the component that holds the call, on the same useCall().
const { incoming } = useCalls(); // those ringing now
</script>
<template>
<template v-if="! call && incoming[ 0 ]">
<p>{{ incoming[ 0 ].info?.name }} is calling</p>
<button @click="answer( incoming[ 0 ] )">Answer</button>
<button @click="incoming[ 0 ].decline()">Decline</button>
</template>
</template><script>
// In the component that holds the call, on the same useCall().
const calls = useCalls(); // those ringing now
</script>
{#if ! current.call && calls.incoming[ 0 ]}
<p>{ calls.incoming[ 0 ].info?.name } is calling</p>
<button onclick={ () => current.answer( calls.incoming[ 0 ] ) }>Answer</button>
<button onclick={ () => calls.incoming[ 0 ].decline() }>Decline</button>
{/if}import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
// realtime.ts, one connection for the whole app:
// export const realtime = connect();
import { realtime } from './realtime';
@Component( {
selector: 'app-ring',
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
template: `<!-- Your ring here -->`,
} )
export class RingComponent {
async ngOnInit() {
const rt = await realtime;
// From now on their calls ring on this page.
rt.onIncomingCall( ( incoming ) => {
showRing( incoming.info?.name, incoming.type );
answer.onclick = () => incoming.accept(); // gives the call, as rt.startCall() does
decline.onclick = () => incoming.decline(); // or decline( 'busy' )
incoming.on( 'over', hideRing ); // answered elsewhere, or the caller gave up
} );
}
}rt.calls.onIncoming { incoming in
showRing(incoming.info["name"], incoming.type)
incoming.onOver { _ in hideRing() } // answered elsewhere, or the caller gave up
Task { @MainActor in
switch try await incoming.accept() { // or try await incoming.decline(busy: true)
case let .call(call): show(call)
case let .group(group): show(group)
}
}
}calls.onIncoming { incoming ->
showRing(incoming.info["name"], incoming.type)
incoming.onOver { hideRing() } // answered elsewhere, or the caller gave up
viewModelScope.launch {
when (val answered = incoming.accept()) { // or incoming.decline(busy = true)
is IncomingCall.Answered.ToCall -> show(answered.call)
is IncomingCall.Answered.ToGroup -> show(answered.group)
}
}
}// In the component that holds the call, on the same useCall().
const { incoming } = useCalls(); // those ringing now
const ring = incoming[ 0 ];
if ( ! call && ring ) {
return (
<View>
<Text>{ ring.info?.name } is calling</Text>
<Button title="Answer" onPress={ () => answer( ring ) } />
<Button title="Decline" onPress={ () => ring.decline() } />
</View>
);
}rt.onIncomingCall((incoming) async {
showRing(incoming.info?['name'], incoming.type);
incoming.onOver((reason) => hideRing()); // answered elsewhere, or the caller gave up
// On your Answer button, or incoming.decline(), decline(busy: true) if busy.
switch (await incoming.accept()) {
case ToCall(:final call):
showCall(call);
case ToGroup(:final group):
showGroup(group);
}
});מצלמה, מיקרופון ומסך
אותן פקודות בשיחה, בשיחה קבוצתית ובשידור חי, כך שלמסך שלכם אין מכשיר לעקוב אחריו. מצלמה נעצרת, והנורית שלה נכבית, כשהיא מכובה או כשהשיחה מסתיימת.
Hooks ורכיבים לכל אפליקציית React, עם כל אחד מהשרתים למעלה.
import { connect } from '@wordplus/realtime';
const rt = await connect();
await call.setMicrophone( false ); // muted
await call.setCamera( false ); // stopped, and the light goes off
const shared = await call.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap on the other side.
const { cameras } = await ( await rt.calls() ).devices();
await call.setCamera( true, { deviceId: cameras[ 1 ].id } );import { connect } from '@wordplus/realtime';
const rt = await connect();
await call.setMicrophone( false ); // muted
await call.setCamera( false ); // stopped, and the light goes off
const shared = await call.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap on the other side.
const { cameras } = await ( await rt.calls() ).devices();
await call.setCamera( true, { deviceId: cameras[ 1 ].id } );import { connect } from '@wordplus/realtime';
const rt = await connect();
await call.setMicrophone( false ); // muted
await call.setCamera( false ); // stopped, and the light goes off
const shared = await call.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap on the other side.
const { cameras } = await ( await rt.calls() ).devices();
await call.setCamera( true, { deviceId: cameras[ 1 ].id } );import { connect } from '@wordplus/realtime';
const rt = await connect();
await call.setMicrophone( false ); // muted
await call.setCamera( false ); // stopped, and the light goes off
const shared = await call.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap on the other side.
const { cameras } = await ( await rt.calls() ).devices();
await call.setCamera( true, { deviceId: cameras[ 1 ].id } );import { connect } from '@wordplus/realtime';
const rt = await connect();
await call.setMicrophone( false ); // muted
await call.setCamera( false ); // stopped, and the light goes off
const shared = await call.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap on the other side.
const { cameras } = await ( await rt.calls() ).devices();
await call.setCamera( true, { deviceId: cameras[ 1 ].id } );import { connect } from '@wordplus/realtime';
const rt = await connect();
await call.setMicrophone( false ); // muted
await call.setCamera( false ); // stopped, and the light goes off
const shared = await call.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap on the other side.
const { cameras } = await ( await rt.calls() ).devices();
await call.setCamera( true, { deviceId: cameras[ 1 ].id } );import { connect } from '@wordplus/realtime';
const rt = await connect();
await call.setMicrophone( false ); // muted
await call.setCamera( false ); // stopped, and the light goes off
const shared = await call.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap on the other side.
const { cameras } = await ( await rt.calls() ).devices();
await call.setCamera( true, { deviceId: cameras[ 1 ].id } );import { connect } from '@wordplus/realtime';
const rt = await connect();
await call.setMicrophone( false ); // muted
await call.setCamera( false ); // stopped, and the light goes off
const shared = await call.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap on the other side.
const { cameras } = await ( await rt.calls() ).devices();
await call.setCamera( true, { deviceId: cameras[ 1 ].id } );import { connect } from '@wordplus/realtime';
const rt = await connect();
await call.setMicrophone( false ); // muted
await call.setCamera( false ); // stopped, and the light goes off
const shared = await call.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap on the other side.
const { cameras } = await ( await rt.calls() ).devices();
await call.setCamera( true, { deviceId: cameras[ 1 ].id } );const rt = window.Echo.connector.rt; // the connection Echo made
await call.setMicrophone( false ); // muted
await call.setCamera( false ); // stopped, and the light goes off
const shared = await call.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap on the other side.
const { cameras } = await ( await rt.calls() ).devices();
await call.setCamera( true, { deviceId: cameras[ 1 ].id } );// In the component that holds the call, on the same useCall().
const { camera, microphone, screen, setCamera, setMicrophone, setScreenShare } = useCall();
return (
<>
<button onClick={ () => setMicrophone( ! microphone ) }>Microphone</button>
<button onClick={ () => setCamera( ! camera ) }>Camera</button>
<button onClick={ () => setScreenShare( ! screen ) }>Share screen</button>
</>
);<script setup>
// In the component that holds the call, on the same useCall().
const { camera, microphone, screen, setCamera, setMicrophone, setScreenShare } = useCall();
</script>
<template>
<button @click="setMicrophone( ! microphone )">Microphone</button>
<button @click="setCamera( ! camera )">Camera</button>
<button @click="setScreenShare( ! screen )">Share screen</button>
</template><!-- In the component that holds the call, on the same useCall(). -->
<button onclick={ () => current.setMicrophone( ! current.microphone ) }>Microphone</button>
<button onclick={ () => current.setCamera( ! current.camera ) }>Camera</button>
<button onclick={ () => current.setScreenShare( ! current.screen ) }>Share screen</button>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
// realtime.ts, one connection for the whole app:
// export const realtime = connect();
import { realtime } from './realtime';
@Component( {
selector: 'app-controls',
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
template: `<!-- Your buttons here -->`,
} )
export class ControlsComponent {
async ngOnInit() {
const rt = await realtime;
await call.setMicrophone( false ); // muted
await call.setCamera( false ); // stopped, and the light goes off
const shared = await call.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap on the other side.
const { cameras } = await ( await rt.calls() ).devices();
await call.setCamera( true, { deviceId: cameras[ 1 ].id } );
}
}call.microphone = false // muted
call.camera = false // stops sending the camera
call.flipCamera() // the front one to the back, and back
// Puts up the system's picker, in an app built with the broadcast extension.
await call.setScreenShare(true)call.microphone = false // muted
call.camera = false // stops sending the camera
call.flipCamera() // the front one to the back, and back
// answer is what the system's dialog gave: ScreenShare.permissionIntent(activity).
call.setScreenShare(true, answer.data)// In the component that holds the call, on the same useCall().
const { call, state } = useCall();
// Sharing the phone's screen isn't in React Native yet.
return (
<>
<Button title="Microphone" onPress={ () => call.setMicrophone( ! state.microphone ) } />
<Button title="Camera" onPress={ () => call.setCamera( ! state.camera ) } />
<Button title="Flip camera" onPress={ () => call.flipCamera() } />
</>
);await call.setMicrophone(false); // muted
await call.setCamera(false); // stopped, and the light goes off
await call.flipCamera(); // the front one to the back, and back
// Android asks with the system's dialog, iOS needs the broadcast extension.
final shared = await call.setScreenShare(true); // false if they said noהוספת אדם שלישי
כשהשיחה כבר פעילה, כל צד יכול לצלצל למישהו נוסף, והיא ממשיכה כשיחה קבוצתית, בלי שאף אחד מנתק. הנתיב שלכם מחליט למי, כמו בכל שיחה, והדף אומר לו על איזו שיחה מדובר. mayAdd היא בדיקה שלכם.
// Your route from the first step. call is the page's call.ref.
if ( ! await mayAdd( me, to ) ) return refuse();
const token = await realtime.callToken( me, to, { into: call } );// Your route from the first step. call is the page's call.ref.
if ( ! await mayAdd( me, to ) ) return refuse();
const token = await realtime.callToken( me, to, { into: call } );// Your route from the first step. call is the page's call.ref.
if ( ! await mayAdd( me, to ) ) return refuse();
const token = await realtime.callToken( me, to, { into: call } );// Your route from the first step. The page's call.ref comes as call.
abort_unless( may_add( $me, $to ), 403 );
$token = Realtime::callToken( $me, $to, [ 'into' => $request->query( 'call' ) ] );// Your route from the first step. The page's call.ref comes as call.
if ( ! may_add( $me, $to ) ) {
http_response_code( 403 );
exit;
}
$token = $realtime->callToken( $me, $to, [ 'into' => $_GET['call'] ] );# Your route from the first step. call is the page's call.ref.
if not may_add(me, to):
return refuse()
token = realtime.call_token(me, to, into=call)# Your route from the first step. call is the page's call.ref.
if not may_add(me, to):
return refuse()
token = realtime.call_token(me, to, into=call)# Your route from the first step. call is the page's call.ref.
if not may_add(me, to):
return refuse()
token = realtime.call_token(me, to, into=call)// Your route from the first step. The page's call.ref comes as call.
if !mayAdd(me, to) {
w.WriteHeader(403)
return
}
token, err := app.AddToCallToken(me, to, r.URL.Query().Get("call"), profile(me))Hooks ורכיבים לכל אפליקציית React, עם כל אחד מהשרתים למעלה.
import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your route with the call, so it rings them into this one.
const answer = await fetch( '/api/call-token?to=56&call=' + call.ref );
const invite = await call.add( ( await answer.json() ).token ); // rings them everywhere they are
// Both sides go on in a group call, with no one hanging up.
call.on( 'group', ( group ) => showGroup( group ) );
invite.on( 'state', ( state ) => showState( state ) ); // answered, rejected, busy, no_answerimport { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your route with the call, so it rings them into this one.
const answer = await fetch( '/api/call-token?to=56&call=' + call.ref );
const invite = await call.add( ( await answer.json() ).token ); // rings them everywhere they are
// Both sides go on in a group call, with no one hanging up.
call.on( 'group', ( group ) => showGroup( group ) );
invite.on( 'state', ( state ) => showState( state ) ); // answered, rejected, busy, no_answerimport { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your route with the call, so it rings them into this one.
const answer = await fetch( '/api/call-token?to=56&call=' + call.ref );
const invite = await call.add( ( await answer.json() ).token ); // rings them everywhere they are
// Both sides go on in a group call, with no one hanging up.
call.on( 'group', ( group ) => showGroup( group ) );
invite.on( 'state', ( state ) => showState( state ) ); // answered, rejected, busy, no_answerimport { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your route with the call, so it rings them into this one.
const answer = await fetch( '/api/call-token?to=56&call=' + call.ref );
const invite = await call.add( ( await answer.json() ).token ); // rings them everywhere they are
// Both sides go on in a group call, with no one hanging up.
call.on( 'group', ( group ) => showGroup( group ) );
invite.on( 'state', ( state ) => showState( state ) ); // answered, rejected, busy, no_answerimport { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your route with the call, so it rings them into this one.
const answer = await fetch( '/api/call-token?to=56&call=' + call.ref );
const invite = await call.add( ( await answer.json() ).token ); // rings them everywhere they are
// Both sides go on in a group call, with no one hanging up.
call.on( 'group', ( group ) => showGroup( group ) );
invite.on( 'state', ( state ) => showState( state ) ); // answered, rejected, busy, no_answerimport { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your route with the call, so it rings them into this one.
const answer = await fetch( '/api/call-token?to=56&call=' + call.ref );
const invite = await call.add( ( await answer.json() ).token ); // rings them everywhere they are
// Both sides go on in a group call, with no one hanging up.
call.on( 'group', ( group ) => showGroup( group ) );
invite.on( 'state', ( state ) => showState( state ) ); // answered, rejected, busy, no_answerimport { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your route with the call, so it rings them into this one.
const answer = await fetch( '/api/call-token?to=56&call=' + call.ref );
const invite = await call.add( ( await answer.json() ).token ); // rings them everywhere they are
// Both sides go on in a group call, with no one hanging up.
call.on( 'group', ( group ) => showGroup( group ) );
invite.on( 'state', ( state ) => showState( state ) ); // answered, rejected, busy, no_answerimport { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your route with the call, so it rings them into this one.
const answer = await fetch( '/api/call-token?to=56&call=' + call.ref );
const invite = await call.add( ( await answer.json() ).token ); // rings them everywhere they are
// Both sides go on in a group call, with no one hanging up.
call.on( 'group', ( group ) => showGroup( group ) );
invite.on( 'state', ( state ) => showState( state ) ); // answered, rejected, busy, no_answerimport { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your route with the call, so it rings them into this one.
const answer = await fetch( '/api/call-token?to=56&call=' + call.ref );
const invite = await call.add( ( await answer.json() ).token ); // rings them everywhere they are
// Both sides go on in a group call, with no one hanging up.
call.on( 'group', ( group ) => showGroup( group ) );
invite.on( 'state', ( state ) => showState( state ) ); // answered, rejected, busy, no_answerconst rt = window.Echo.connector.rt; // the connection Echo made
// Asks your route with the call, so it rings them into this one.
const answer = await fetch( '/api/call-token?to=56&call=' + call.ref );
const invite = await call.add( ( await answer.json() ).token ); // rings them everywhere they are
// Both sides go on in a group call, with no one hanging up.
call.on( 'group', ( group ) => showGroup( group ) );
invite.on( 'state', ( state ) => showState( state ) ); // answered, rejected, busy, no_answer// In the component that holds the call, on the same useCall().
const { call, group } = useCall(); // group: the call goes on as this group call
async function addCara() {
// Asks your route with the call, so it rings them into this one.
const answer = await fetch( '/api/call-token?to=56&call=' + call.ref );
await call.add( ( await answer.json() ).token );
}
return <button onClick={ addCara }>Add Cara</button>;<script setup>
// In the component that holds the call, on the same useCall().
const { call, group } = useCall(); // group: the call goes on as this group call
async function addCara() {
// Asks your route with the call, so it rings them into this one.
const answer = await fetch( '/api/call-token?to=56&call=' + call.value.ref );
await call.value.add( ( await answer.json() ).token );
}
</script>
<template>
<button @click="addCara">Add Cara</button>
</template><script>
// In the component that holds the call, on the same useCall(). current.group: the call goes on as this group call.
async function addCara() {
// Asks your route with the call, so it rings them into this one.
const answer = await fetch( '/api/call-token?to=56&call=' + current.call.ref );
await current.call.add( ( await answer.json() ).token );
}
</script>
<button onclick={ addCara }>Add Cara</button>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
// realtime.ts, one connection for the whole app:
// export const realtime = connect();
import { realtime } from './realtime';
@Component( {
selector: 'app-add-person',
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
template: `<!-- Your button here -->`,
} )
export class AddPersonComponent {
async ngOnInit() {
const rt = await realtime;
// Asks your route with the call, so it rings them into this one.
const answer = await fetch( '/api/call-token?to=56&call=' + call.ref );
const invite = await call.add( ( await answer.json() ).token ); // rings them everywhere they are
// Both sides go on in a group call, with no one hanging up.
call.on( 'group', ( group ) => showGroup( group ) );
invite.on( 'state', ( state ) => showState( state ) ); // answered, rejected, busy, no_answer
}
}// Both sides go on in a group call, with no one hanging up.
call.onGroup { group in follow(group) }
// Your own request to your route, with the call.
let token = try await api.callToken(to: "56", call: call.ref)
let invite = try await call.add(token) // rings them everywhere they are
invite.onState { state in label.text = state } // answered, rejected, busy, no_answer// Both sides go on in a group call, with no one hanging up.
call.onGroup { group -> follow(group) }
// Your own request to your route, with the call.
val token = api.callToken(to = "56", call = call.ref)
val invite = call.add(token) // rings them everywhere they are
invite.onState { state -> label.text = state } // answered, rejected, busy, no_answer// In the component that holds the call, on the same useCall().
const rt = useRealtime();
const { call, group } = useCall(); // group: the call goes on as this group call
async function addCara() {
// Asks your route with the call, so it rings them into this one.
await call.add( await rt.tokenFrom( API + '/call-token', { to: 56, call: call.ref } ) );
}
return <Button title="Add Cara" onPress={ addCara } />;// Both sides go on in a group call, with no one hanging up.
call.onGroup((group) => showGroup(group));
// Asks your route with the call, so it rings them into this one.
final token = await rt.tokenFrom('$api/call-token', {'to': 56, 'call': call.ref});
final invite = await call.add(token); // rings them everywhere they are
invite.onState((state) => showInvite(state)); // answered, rejected, busy, no_answerלמה שיחה הסתיימה
כל שיחה אומרת למה היא הסתיימה, כדי שהמסך שלכם יציע את הדבר הנכון בהמשך, למשל להשאיר הודעה כשאף אחד לא ענה.
Hooks ורכיבים לכל אפליקציית React, עם כל אחד מהשרתים למעלה.
import { connect } from '@wordplus/realtime';
const rt = await connect();
call.on( 'state', ( state ) => {
if ( state !== 'ended' ) return;
// hangup, cancelled, rejected, busy, no_answer, page_closed, peer_lost, group
if ( call.endReason === 'no_answer' ) offerMessage();
} );import { connect } from '@wordplus/realtime';
const rt = await connect();
call.on( 'state', ( state ) => {
if ( state !== 'ended' ) return;
// hangup, cancelled, rejected, busy, no_answer, page_closed, peer_lost, group
if ( call.endReason === 'no_answer' ) offerMessage();
} );import { connect } from '@wordplus/realtime';
const rt = await connect();
call.on( 'state', ( state ) => {
if ( state !== 'ended' ) return;
// hangup, cancelled, rejected, busy, no_answer, page_closed, peer_lost, group
if ( call.endReason === 'no_answer' ) offerMessage();
} );import { connect } from '@wordplus/realtime';
const rt = await connect();
call.on( 'state', ( state ) => {
if ( state !== 'ended' ) return;
// hangup, cancelled, rejected, busy, no_answer, page_closed, peer_lost, group
if ( call.endReason === 'no_answer' ) offerMessage();
} );import { connect } from '@wordplus/realtime';
const rt = await connect();
call.on( 'state', ( state ) => {
if ( state !== 'ended' ) return;
// hangup, cancelled, rejected, busy, no_answer, page_closed, peer_lost, group
if ( call.endReason === 'no_answer' ) offerMessage();
} );import { connect } from '@wordplus/realtime';
const rt = await connect();
call.on( 'state', ( state ) => {
if ( state !== 'ended' ) return;
// hangup, cancelled, rejected, busy, no_answer, page_closed, peer_lost, group
if ( call.endReason === 'no_answer' ) offerMessage();
} );import { connect } from '@wordplus/realtime';
const rt = await connect();
call.on( 'state', ( state ) => {
if ( state !== 'ended' ) return;
// hangup, cancelled, rejected, busy, no_answer, page_closed, peer_lost, group
if ( call.endReason === 'no_answer' ) offerMessage();
} );import { connect } from '@wordplus/realtime';
const rt = await connect();
call.on( 'state', ( state ) => {
if ( state !== 'ended' ) return;
// hangup, cancelled, rejected, busy, no_answer, page_closed, peer_lost, group
if ( call.endReason === 'no_answer' ) offerMessage();
} );import { connect } from '@wordplus/realtime';
const rt = await connect();
call.on( 'state', ( state ) => {
if ( state !== 'ended' ) return;
// hangup, cancelled, rejected, busy, no_answer, page_closed, peer_lost, group
if ( call.endReason === 'no_answer' ) offerMessage();
} );const rt = window.Echo.connector.rt; // the connection Echo made
call.on( 'state', ( state ) => {
if ( state !== 'ended' ) return;
// hangup, cancelled, rejected, busy, no_answer, page_closed, peer_lost, group
if ( call.endReason === 'no_answer' ) offerMessage();
} );// In the component that holds the call, on the same useCall().
const { endReason } = useCall();
// hangup, cancelled, rejected, busy, no_answer, page_closed, peer_lost, group
return endReason === 'no_answer' ? <OfferMessage /> : null;<script setup>
// In the component that holds the call, on the same useCall().
const { endReason } = useCall();
</script>
<template>
<!-- hangup, cancelled, rejected, busy, no_answer, page_closed, peer_lost, group -->
<OfferMessage v-if="endReason === 'no_answer'" />
</template><!-- In the component that holds the call, on the same useCall(). -->
<!-- hangup, cancelled, rejected, busy, no_answer, page_closed, peer_lost, group -->
{#if current.endReason === 'no_answer'}
<OfferMessage />
{/if}import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
// realtime.ts, one connection for the whole app:
// export const realtime = connect();
import { realtime } from './realtime';
@Component( {
selector: 'app-call-end',
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
template: `<!-- Your message here -->`,
} )
export class CallEndComponent {
async ngOnInit() {
const rt = await realtime;
call.on( 'state', ( state ) => {
if ( state !== 'ended' ) return;
// hangup, cancelled, rejected, busy, no_answer, page_closed, peer_lost, group
if ( call.endReason === 'no_answer' ) offerMessage();
} );
}
}// hangup, cancelled, rejected, busy, no_answer, page_closed, peer_lost, group
call.onEnded { reason in
if reason == "no_answer" { offerMessage() }
}// hangup, cancelled, rejected, busy, no_answer, page_closed, peer_lost, group
call.onEnded { reason ->
if (reason == "no_answer") offerMessage()
}// In the component that holds the call, on the same useCall().
const { endReason } = useCall();
// hangup, cancelled, rejected, busy, no_answer, page_closed, peer_lost, group
return endReason === 'no_answer' ? <OfferMessage /> : null;// hangup, cancelled, rejected, busy, no_answer, page_closed, peer_lost, group
call.onEnded((reason) {
if (reason == 'no_answer') offerMessage();
});חיוב לפי דקה
השרת שלכם יודע כמה זמן נמשכה כל שיחה, כפי שנספר בשרתים שלנו, כדי שתוכלו לחייב את המשתמשים שלכם. האירוע עשוי להגיע פעמיים, לכן חייבו פעם אחת על כל id. charge היא פונקציה שלכם.
// The caller, for the time talked, by the minute begun. Charge once for each id.
realtime.on( 'call.ended', async ( { id, from, seconds } ) => {
if ( seconds > 0 ) await charge( id, from, Math.ceil( seconds / 60 ) );
} );// The caller, for the time talked, by the minute begun. Charge once for each id.
realtime.on( 'call.ended', async ( { id, from, seconds } ) => {
if ( seconds > 0 ) await charge( id, from, Math.ceil( seconds / 60 ) );
} );// The caller, for the time talked, by the minute begun. Charge once for each id.
realtime.on( 'call.ended', async ( { id, from, seconds } ) => {
if ( seconds > 0 ) await charge( id, from, Math.ceil( seconds / 60 ) );
} );$this->callAfterResolving( Realtime::class, function ( Realtime $realtime ) {
// The caller, for the time talked, by the minute begun. Charge once for each id.
$realtime->on( 'call.ended', function ( array $e ) {
if ( $e['seconds'] > 0 ) {
charge( $e['id'], $e['from'], (int) ceil( $e['seconds'] / 60 ) );
}
} );
} );// The caller, for the time talked, by the minute begun. Charge once for each id.
$realtime->on( 'call.ended', function ( array $e ) {
if ( $e['seconds'] > 0 ) {
charge( $e['id'], $e['from'], (int) ceil( $e['seconds'] / 60 ) );
}
} );# The caller, for the time talked, by the minute begun. Charge once for each id.
def call_ended(e):
if e["seconds"] > 0:
charge(e["id"], e["from"], math.ceil(e["seconds"] / 60))
realtime.on("call.ended", call_ended)# The caller, for the time talked, by the minute begun. Charge once for each id.
def call_ended(e):
if e["seconds"] > 0:
charge(e["id"], e["from"], math.ceil(e["seconds"] / 60))
realtime.on("call.ended", call_ended)# The caller, for the time talked, by the minute begun. Charge once for each id.
def call_ended(e):
if e["seconds"] > 0:
charge(e["id"], e["from"], math.ceil(e["seconds"] / 60))
realtime.on("call.ended", call_ended)// In your webhook route, once its signature is checked as the docs say.
// The caller, for the time talked, by the minute begun. Charge once for each id.
if event.Type == "call.ended" && event.Seconds > 0 {
charge(event.ID, event.From, (event.Seconds+59)/60)
}שיחות בכל stack, עם ההגדרה המלאה:
שיחות וידאו ב-Next.js
שיחות וידאו ב-Express
שיחות וידאו ב-Laravel
שיחות וידאו ב-PHP
שיחות וידאו ב-Django
שיחות וידאו ב-FastAPI
שיחות וידאו ב-Flask
שיחות וידאו ב-iOS
שיחות וידאו ב-Android
או צעד אחר צעד, באפליקציה אמיתית: איך לממש שיחות וידאו ב-Next.js
מוכן או שלכם
מסך שיחה מוכן לשימוש, או משלכם
מסך השיחה מוכן לשימוש: כפתורי שיחה, הצלצול וחלון השיחה, באתר, ב-iOS וב-Android. שנו את הצבעים והטקסטים שלו, החליפו חלק ממנו בשלכם, או בנו ממשק משלכם על אותו SDK.

שיחות בין שני אנשים מוצפנות מקצה לקצה בכל נתיב, ושיחה קבוצתית מוצפנת כשהשרת שלכם קובע זאת.
יותר משני אנשים? שיחות קבוצתיות רצות על שרתי המדיה שלנו, עם מארחים, דוברים ומאזינים.
שימושים
מה בונים עם שיחות
כל אחד מהם הוא אפליקציה שלמה בתיעוד, עם השרת שלה ב-Node.js, PHP ו-Python.
שיחות בלחיצת כפתור
כפתור התקשרות לתמיכה שמצלצל אצל הנציג בכל לשונית שפתוחה אצלו.
ייעוץ בתיאום מראש
פגישת וידאו עם רופאה, עורך דין, מורה פרטית או מאמן, פתוחה רק לשניים שקבעו אותה, בשעה שלה.
פגישות צוות
פגישת וידאו לכל צוות או אירוע, עם שיתוף מסך, שהמנחה מסיים לכולם.
שיעורים וחדרי אודיו
מורה או פאנל מדברים והשאר מאזינים, ומרימים יד כדי לדבר.
חדרי המתנה וחדרי קבוצות
אורחים ממתינים עד שהמארח מכניס אותם, והמארח שולח אנשים לחדרים קטנים יותר ומחזיר אותם.
חיוב על שיחות
השרת שלכם יודע כמה זמן כל אדם דיבר, כפי שנספר בשרתים שלנו, כדי לחייב לפי דקה.
מחירים
מחיר לפי חיבורים, אף פעם לא לפי הודעות
החל מ-$11.99 לחודש עבור 1,000 חיבורים בו-זמניים, בחיוב שנתי, או $14.99 בחיוב חודשי.
שיחות קבוצתיות מעבר לתוכנית שלכם: $0.20 לכל 1,000 דקות, $0.10 באודיו.
מחיר אחד בכל רזולוציה. רוחב פס, ממסרים והודעות לעולם לא מחויבים, ושיחות בין שני אנשים כלולות. אנחנו מפעילים בעצמנו את הממסרים ושרתי המדיה שלנו, וזה שומר על המחירים האלה נמוכים.
מחיר לפי חיבורים בו-זמניים, החל מ-1,000, בחיוב חודשי או שנתי. שיחות בין שני אנשים ללא הגבלה.
עם 1,000 חיבורים, שיחות קבוצתיות אינן נמדדות עד 32 אנשים בווידאו בו-זמנית, ואדם באודיו נספר כחצי, ללא הגבלת משתתפים בשיחה. כל 1,000 חיבורים נוספים מוסיפים 12 אנשים בווידאו. מעבר לזה, כל אדם נוסף בווידאו צורך קרדיט לדקה, באודיו חצי, והתוכנית שלכם מוסיפה 5,000 קרדיטים בחודש לכל 1,000 חיבורים.
שאלות
שאלות נפוצות
האם אני צריך שרתי TURN או שרתי מדיה משלי?
לא. שיחה בין שני אנשים עוברת ישירות בין שני המכשירים כשאפשר, דרך הממסרים שלנו כשחומת אש חוסמת את הדרך הישירה, ודרך שרתי המדיה שלנו כשאפילו הממסרים לא מגיעים. שיחות קבוצתיות רצות על שרתי המדיה שלנו בכמה אזורים. אין לכם מה לארח.
אילו stacks יכולים להשתמש ב-SDK לשיחות וידאו?
Next.js ו-Express, Laravel ו-PHP נקי, Django, FastAPI ו-Flask, Capacitor, iOS ו-Android, כל אחד עם מדריך. שרת בכל שפה אחרת משתמש ב-HTTP API. לאפליקציות Flutter יש שיחות ב-iOS וב-Android, ולאפליקציות React Native בינתיים ב-iOS.
כמה אנשים יכולים להצטרף לשיחה קבוצתית?
אין הגבלת משתתפים בשיחה. עם 1,000 חיבורים, עד 32 אנשים בווידאו בו-זמנית אינם צורכים קרדיטים, ואדם באודיו נספר כחצי, וכל 1,000 חיבורים נוספים מוסיפים 12. מעבר לזה, כל אדם נוסף בווידאו צורך קרדיט לדקה.
האם השיחות מוצפנות?
כן. המדיה של שיחה בין שני אנשים מוצפנת מקצה לקצה בכל נתיב, גם כשהממסרים או שרתי המדיה שלנו מעבירים אותה. שיחה קבוצתית מוצפנת מקצה לקצה כשהשרת שלכם קובע זאת, במפתח שרק השרת שלכם מוסר.
איפה השרתים שלכם?
הממסרים ושרתי המדיה שלנו פועלים במדינות האלה: גרמניה, צרפת, בריטניה, פולין, קנדה וסינגפור. כל שיחה עוברת דרך השרת הקרוב ביותר למשתתפים בה. בקרוב: ארצות הברית, אוסטרליה, הודו ואיטליה. שרתי זמן האמת שמעבירים את האירועים שלכם פועלים בגרמניה.
מי מחליט מי רשאי להתקשר למי?
האפליקציה שלכם. השרת שלכם נותן לדף אסימון לכל שיחה שהוא מאשר, ולכל אדם שמצטרף לשיחה קבוצתית, וקובע בו מי מדבר ומי רק מאזין, ומי מארח. כך שמי רשאי לעשות מה נקבע בלוגיקה שלכם, ושום דבר לא מתחיל בלי אסימון. הענן אוכף כל אסימון, והשרת שלכם יכול לבטל גישה בכל רגע.
האם אפשר לבנות ממשק שיחה משלי?
כן. מסך השיחה הוא אופציונלי. שנו את הצבעים והטקסטים שלו, או התחילו, ענו והציגו שיחות בעצמכם עם ה-SDK, עד לכל אדם בשיחה קבוצתית.
האם אפשר לחייב את המשתמשים שלי על שיחות?
כן. WordPlus Cloud מודיע לשרת שלכם ב-webhook כמה זמן נמשכה כל שיחה ומתי כל אדם הצטרף לשיחה קבוצתית ועזב אותה, כפי שנספר בשרתים שלו, כדי שהאפליקציה שלכם תחייב לפי דקה.
שאלות על האינטגרציה שלכם? כתבו לנו: אנחנו עוזרים עם ה-SDK, מסך השיחה וה-stack שלכם.