最近在研究 jellyfin-sdk-kotlin,一直没搞明白 websocket 的各种消息是如何触发的,看 sdk 的支持列表里有 UserUpdateMessage,添加监听并且修改用户信息后,消息一直没有发送过来.
runBlocking {
println("Starting subscription")
val connection = apiClient.ws()
connection.addListener<UserUpdatedMessage>() {
println("数据监听")
}
// Listen for messages
// this automatically subscribes to activity log entries etc.
connection.addGlobalListener { message ->
println("Received $message")
}
awaitCancellation()
}