Skip to main content

Realtime voice-to-voice

Gabber offers WebRTC-based voice-to-voice sessions.

Server

To securely integrate Gabber into your application, you'll need to implement a small amount of server-side code. This ensures that your GABBER_API_KEY remains confidential and allows you to generate tokens that act on behalf of your users with specific usage limits.

The following Express handler shows how to generate a token for client-side use.

app.get('/token', async (req: Request, res: Response) => {
try {
const human_id = await myFunctionForGettingUserIdFromRequest(req);
const response = await axiosInstance.post('/v1/usage/token', {
human_id,
limits: [{type: "conversational_seconds", value: 120}] // Set limit on 'conversational_seconds' to 120
});
const token = response.data.token;
res.json({ token });
} catch (error) {
console.error(error);
res.status(500).json({ error: 'An error occurred' });
}
});

(An example express server)[https://github.com/gabber-dev/example-server] is available and can be used with the example apps.

Client App

Once the server-side endpoint is set up, your client-side application can request tokens as needed. Clients use these tokens as authentication when making calls to the Gabber API.

Voice-to-voice sessions are started by calling POST/v1/realtime/start which returns connection details.

See our (full example apps)[https://github.com/gabber-dev] for specifics.