Skip to main content

appsocom 0.6.2 copy "appsocom: ^0.6.2" to clipboard
appsocom: ^0.6.2 copied to clipboard

Dart server SDK for Appsocom Live video calls - join tokens, room admin, moderation, metadata and webhook verification.

appsocom (Dart server SDK) #

Dart server SDK for Appsocom Live, for backends such as Dart Frog, Shelf or Serverpod: mint join tokens, manage rooms and participants, moderate and verify webhooks. It needs your project's API key, so never use it inside a Flutter app; the app gets a join token from your backend and uses appsocom_flutter.

dart pub add appsocom
import 'dart:io';
import 'package:appsocom/appsocom.dart';

final env = Platform.environment;
final kit = SfuKit(url: 'https://api.appsocom.dev', adminKey: env['APPSOCOM_API_KEY']!); // project API key

final tok = await kit.createToken('class-1', 'u_7', name: 'Ada', role: 'student', metadata: {'seat': 3});

await kit.setRole('class-1', 'u_9', 'student');           // promote an observer
await kit.mute('class-1', '*', devices: ['mic'], lock: true);
await kit.setRoomMetadata('class-1', {'topic': 'Fractions'});
await kit.setTrackPermissions('class-1', 'u_7', {'allowAll': false, 'allow': [{'userId': 'u_1'}]});
await kit.removeParticipant('class-1', 'u_8', ban: true);

Errors throw SfuKitError with status and body.

Webhooks (Shelf):

Future<Response> hook(Request req) async {
  final event = verifyWebhook(env['APPSOCOM_WEBHOOK_SECRET']!, await req.readAsString(), req.headers['x-sfukit-signature']);
  if (event == null) return Response(401);
  print('${event['event']} ${event['roomId']}');
  return Response(204);
}

Same methods as the Node SDK (camelCase), plus standalone signToken, verifyWebhook, signWebhook.

Self-hosting your own deployment instead? Point url at it and pass its admin key; the optional jwtSecret signs tokens locally without an HTTP call.

Docs: docs.appsocom.dev · License: MIT

0
likes
140
points
69
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Dart server SDK for Appsocom Live video calls - join tokens, room admin, moderation, metadata and webhook verification.

Homepage

Topics

#video #webrtc #server

License

MIT (license)

Dependencies

crypto, http

More

Packages that depend on appsocom