Skip to main content

Client API and events

Names below use TypeScript semantics. Follow the platform guides for actual signatures and Version notes for source/release differences.

Common methods​

APIMeaning
initialize / enterClassroomInitialize and enter; Web initialize receives the classroom
startClass / endClassStart/end class, subject to role and state
leaveClassroom / destroyLeave as current user / release instance
getClassInfoRead lifecycle, class information and timer
getClassroomInteractionPolicyRead action availability and restriction reasons
setLocalAudioMuted / setLocalVideoMutedAccept local device changes; false requests opening
userRaiseHand / userCancelHand / userLeaveStageRaise/cancel hand and leave stage
inviteUserOnStage / approveUserOnStage / rejectUserOnStage / removeUserFromStageTeacher stage management
getOnStageUserList / getRaisedHandListRead stage and raised-hand lists
getUserPermissionList / loadMemberPermissionsRead own permissions / asynchronously load member permissions
sendImMessage / getImMessageListSend group text / read current message window
loadImMessageHistory / getImHistoryStateLoad history / read pagination state
getClassroomCourseware / getCoursewareManifestRead bound courseware / asynchronously load manifest

History defaults to 50 messages per page with limit 1–100. Use returned nextCursor for subsequent pages. getImMessageList() reads at most 200 in-memory messages without requesting history. Load a courseware manifest only when status === 'ready'; do not block the rendering thread.

Event subscription​

Web/mini programs use sdk.on, which returns an unsubscribe function:

const unsubscribe = sdk.on('onStreamInfoChanged', (streams) => {
renderStreams(streams);
});
// When the view no longer needs this subscription:
unsubscribe();

Kotlin uses addStreamInfoChangedListener; Swift uses onStreamInfoChanged. destroy clears subscriptions. Avoid updating unmounted views from callbacks.

APIMeaning
onJoinSuccessRequired backend and IM domains are ready
onJoinProgressConnection phase and capability-domain states
onClassInfoChangedClass information and lifecycle changes
onOnStageUsersChangedOn-stage membership changes
onUserPermissionsChangedEffective permission changes
onStreamInfoChangedActual local/remote stream state changes
onImMessageReceivedNotification after message state updates
onWhiteboardRecoveryRequestedRequest whiteboard reload after recovery
onWhiteboardLiveStrokeReceivedEphemeral live strokes, not final operation commits
onErrorAsynchronous SDK errors

Do not display a device as open merely because its command returned; wait for onStreamInfoChanged. Teacher-muted callbacks also follow actual device closure.

Whiteboard and teaching tools​

UI Kit handles DrawsKit mounting and synchronization. Headless hosts connect whiteboard adapters, synchronization and recovery events. sendWhiteboardSync and sendWhiteboardLiveStroke primarily serve that adapter layer.

Source builds submit teaching-tool requests through requestTeachingTools(requestJson). Correlate operation results by request ID in the tool view. Available tools depend on server deployment; the teaching blackboard is not yet available. See Client SDK overview for platform requirements.