Flutter SDK Guide

Mobile integration guide for Flutter clients using Blendlix Call Service.

Flutter

Flutter clients usually need:

  • an HTTP client for requesting the application backend session endpoint
  • a WebSocket client for signaling
  • a WebRTC package for audio
  • microphone permission handling

Suggested flow

1. Request call session from application backend.
2. Ask for microphone permission.
3. Connect to WebSocket using the session token.
4. Send or receive call events.
5. Create WebRTC peer connection with returned ICE servers.
6. Exchange offer, answer, and ICE candidates through WebSocket.
7. Stop microphone tracks and close connections when the call ends.

Pseudo-code

final session = await backend.createCallSession(receiverId);

final socket = WebSocketChannel.connect(
  Uri.parse(session.wsUrl),
  protocols: ['jwt', session.token],
);

socket.stream.listen((message) {
  final event = jsonDecode(message);
  handleCallEvent(event);
});

sendInvite() {
  socket.sink.add(jsonEncode({
    'event': 'call.invite',
    'request_id': requestId(),
    'data': {
      'callee_user_id': receiverId,
      'callee_role': receiverRole,
      'context_type': contextType,
      'context_id': contextId,
    },
  }));
}

Mobile reminders

  • Request microphone permission before starting media.
  • Keep phone-call fallback available if permissions are denied.
  • Do not store product secrets in the mobile app.
  • Recreate session tokens when they expire.