@crvouga/mockingbird-service-livekit (英语)
本地模拟器。 真正的API合同. 部分 嘲笑鸟。 。 。 .
状态 LiveKit 模拟器 livekit-server-sdk它为Twirp JSON室和代理发送API服务,验证了真正的HS256 LiveKit赠款,模型参与者/跟踪/数据状态,暴露了决定性的SIP和Egress控制,并正确发布了已签名的生命周期网络呼号.
安装
npm install -D @crvouga/mockingbird-service-livekit
仅限无害环境管理。 节点22+或Bun 1.2+.
使用量
import { RoomServiceClient } from "livekit-server-sdk"
import { createServer } from "@crvouga/mockingbird-service-livekit/server"
// Test setup: the emulator, with the API key and secret the application signs with.
const emulator = await createServer({
keys: { fixture: "fixture-secret-that-is-at-least-32-chars" },
})
// The application's client. Only the host changes.
const rooms = new RoomServiceClient(emulator.url, "fixture", "fixture-secret-that-is-at-least-32-chars")
const room = await rooms.createRoom({ name: "consult", emptyTimeout: 60, maxParticipants: 4 })
const listed = await rooms.listRooms() // [room]
await emulator.close()
点 RoomServiceClient 时间 emulator.url。支持的房间服务电话包括 Create Room, ListRooms, Delete Room, Update RoomMetata, ListParticipants, GetParticipant, RemoveParticipant, UpdateParticipant, MutePublishedTrack, 和 SendData 。 房间的创建按名字是独有的,参与者身份在一个房间内是独一无二的.
AgentDispatchClient 使用相同的 URL 和 真 roomAdmin JWT 用于 createDispatch, (中文(简体) ), listDispatch, (中文(简体) ), getDispatch,以及 deleteDispatch。蛇大小写和骆驼小写请求字段工作。 发送会创建一个缺失的房间,开始没有指定工作,并保留其代理名和不透明的元数据. 列表读取了共享房间调度状态,并带有可选的调度标识过滤器;删除调度会删除其会员身份. 删除或过期将取消其调度。 调度/工作时间戳是仿真-时钟 Unix秒被编码为protobuf JSON字符串(SDK会暴露出比金特值). 测试对HTTP进行现有的2.19.1 SDK和记者准确的2.19.0.
控件
POST /__admin/rooms/:room/participants加入一个合成参与者.DELETE /__admin/rooms/:room/participants/:identity断开它.POST /__admin/rooms/:room/participants/:identity/tracks发布一个音轨.GET /__admin/rooms/:room/participants/:identity/inbox检查目标数据.GET /__admin/resources财务报告和审定财务报表POST /__admin/resources/:id/transition检查和推进SIP/入侵状态.POST /__admin/dispatches/:id/jobs脚本 :{status?: "JS_PENDING"|"JS_RUNNING"|"JS_SUCCESS"|"JS_FAILED", workerId?, agentId?, participantIdentity?, error?}第一次任务创造了稳定的工作身份;后来调用更新并盖上其开始/结束/更新时间。 默认状态正在运行 .- 调度和工作与房间状态一起参与命名空间、重置、快照、时间线和故障恢复.
- 故障预设包括速率限制,网络损失,和webhook重复/重排/投放交付.
Webhooks覆盖房间,参与者,轨迹, Egress, 和SIP过渡. 每个生体都有一个短命的LiveKit访问符签上 sha256 官方接受了索赔要求 WebhookReceiver。 。 。 .
API 密码
LiveKitAPI, (中文(简体) ),LiveKitAPIOptions, (中文(简体) ),LiveKitEvent: 处理者和事件合同.LiveKitRoom, (中文(简体) ),LiveKitParticipant, (中文(简体) ),LiveKitTrack, (中文(简体) ),DataMessage, (中文(简体) ),AsyncResource, (中文(简体) ),AgentDispatch, (中文(简体) ),AgentJob, (中文(简体) ),JobStatus: 持久状态.createRuntime, (中文(简体) ),LiveKitRuntime, (中文(简体) ),LiveKitRuntimeOptions:全程运行和webhook中枢.LIVEKIT_NAMESPACE, (中文(简体) ),LIVEKIT_PRESETS:常数和故障控制.document, (中文(简体) ),operationIds, (中文(简体) ),supportedOperationIds: 生成了 OpenAPI 元数据.createServer, (中文(简体) ),LiveKitServerOptions, (中文(简体) ),DEFAULT_PORT, (中文(简体) ),serveTarget从./server:节点适配器和CLI集成.
故意不模拟
真正的代理工人登记、工作执行、出版商发送、重新启动/部署政策、WebRTC媒体运输、信号套接字、转码、PSTN电话、生产规模、计费和仪表板没有模拟。 定型服务器API和生命周期合同是最初的忠诚界限.
官方预言: LiveKit 房间服务 API 财务报告和审定财务报表 代理发送服务 API。 。 。 .