Skip to main content

socrits 0.1.0 copy "socrits: ^0.1.0" to clipboard
socrits: ^0.1.0 copied to clipboard

retracted

Socrits SDK for Flutter - video & voice calls, call invitations (ring/accept), and in-app chat. Drop-in prebuilt UI kit plus a low-level core client.

socrits — Flutter SDK #

Call invitations (signalling) + audio/video calls on your self-hosted Socrits. A drop-in replacement for ZEGO's call-invitation + prebuilt-call stack — same concepts, your infrastructure.

Install #

dependencies:
  socrits:
    path: ../suryacloud/sdk/flutter   # or a git/pub ref once published

Usage #

final sc = Socrits(baseUrl: 'https://api.socrits.example');

// your backend mints the user token via POST /v1/session (API key stays server-side)
await sc.connect(sessionEndpoint: 'https://your-backend/sc-session', userId: 'alice');

// a ring arrives → show your incoming-call UI
sc.onIncomingCall = (call) {
  // call.fromUserName, call.mode …
  // sc.accept(call);  or  sc.reject(call);
};

// call connected → render the media room with the prebuilt call UI
sc.onCallConnected = (room, mode) {
  Navigator.push(context, MaterialPageRoute(builder: (_) => Scaffold(
    body: SocritsCallView(room: room, onHangUp: () => Navigator.pop(context)),
  )));
};

sc.onCallRejected = (callId) {};       // ZEGO onOutgoingCallDeclined
sc.onCallEnded    = (reason) {};       // 'timeout' (no answer) | 'cancelled'

// place a call
final callId = await sc.invite(toUserId: 'bob', mode: CallMode.video);

// in-call data (e.g. the coin/minute balance sync)
sc.sendData('bob', callId, {'coin_balance': 120});
sc.onData = (from, data) { /* … */ };

Mapping from ZEGO #

ZEGO (dating app used this) Socrits SDK
ZegoUIKitPrebuiltCallInvitationService().send(...) sc.invite(toUserId: ..., mode: ...)
onIncomingCall (ring) sc.onIncomingCall
accept() sc.accept(call) → joins the LiveKit room
onOutgoingCallDeclined sc.onCallRejected
onOutgoingCallTimeout sc.onCallEnded('timeout')
sendInRoomCommand(...) sc.sendData(...)
appID + appSign (client secret) server-minted token — no secret in the app

Prebuilt call UI #

SocritsCallView(room: room) is a drop-in call screen — video grid + mic / camera / hang-up controls (the ZegoUIKitPrebuiltCall equivalent). Or render the room yourself with livekit widgets.

Native ringing (offline / CallKit) #

So a call rings on a locked phone with the app closed:

  1. Register the device after connecting:
    final fcmToken = await FirebaseMessaging.instance.getToken();
    sc.registerDevice(fcmToken!);        // stored server-side per user
    
  2. Socrits pushes an incoming_call FCM data message when the callee is offline (set FCM_SERVICE_ACCOUNT on the server to enable real sends).
  3. In your FCM background handler, show native UI with flutter_callkit_incoming; on accept, connect() and accept(call) to join.

The push payload carries callId, room, mode, fromUserId, fromUserName.

1
likes
0
points
809
downloads

Documentation

Documentation

Publisher

verified publishersocrits.com

Weekly Downloads

Socrits SDK for Flutter - video & voice calls, call invitations (ring/accept), and in-app chat. Drop-in prebuilt UI kit plus a low-level core client.

Homepage

Topics

#video #voip #webrtc #chat #calling

License

unknown (license)

Dependencies

flutter, http, livekit_client, socket_io_client

More

Packages that depend on socrits