Realtime communication

Realtime communication

If your app has a chat module (group, 1-on-1, video, audio, text), there’s a ton of useful data that you can attach automatically and would come in handy later when you try to debug the problem.

App.kt
import com.shakebugs.shake.Shake
private fun connectToChatServer(username: String, password: String) {
ChatServer.connect(username, password, object: ServerListener() {
@override
fun onConnected(user: User) {
Shake.setMetadata("serverStatusType", "Connected")
Shake.setMetadata("serverStatusDate", Date().toString())
Message.show("Server connected")
}
@override
fun onDisconnected(message: String) {
Shake.setMetadata("serverStatusType", "Disconnected")
Shake.setMetadata("serverStatusDate", Date().toString())
Message.show("Server disconnected")
}
})
}