@startuml 
!include agora_skin.iuml
skinparam SequenceGroupBodyBackgroundColor transparent

actor "User" as USR

box "Your app"
participant "IoT SDK" as APP
end box

box "Agora"
participant "SD-RTN" as API
end box

group Setup Agora engine
APP -> APP: Instantiate the Agora engine
APP -> APP: Set engine options
APP -> API: Verify license and initialize
end

group Create multiple connections
APP -> API: Create connection-1 
APP -> API: Create connection-2
end

group Stream to multiple channels
USR -> APP: Join channels
APP -> API: Join channel-1 using connectionId-1
APP -> API: Join channel-2 using connectionId-2
APP -> API: Send audio and video data using \nconnectionId-1 to stream to channel-1
APP -> API: Send audio and video data using \nconnectionId-2 to stream to channel-2
end

group Push multiple streams to a single channel
USR -> APP: Join channel
APP -> API: Join channel-1 using \nconnectionId-1 and userId-1
APP -> API: Join channel-1 using \nconnectionId-2 and userId-2
APP -> API: Send audio and video data \nusing connectionId-1 
APP -> API: Send audio and video data \nusing connectionId-2 
end

group Leave channel(s)
USR -> APP: Leave channel
APP -> API: Call leave channel using connectionId-1
APP -> API: Call leave channel using connectionId-2
end

group Clean up
APP -> API: Call destroy connection \nusing connectionId-1
APP -> API: Call destroy connection \nusing connectionId-2
APP -> API: Call the finish method to release resources
end

@enduml
