You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In simple words, there are many ways to implement the feature according to your business requirements.
The simplest way: For clients, you can use notificationService.addNotificationListener to listen to any notifications and then implement your business logic. e.g.:
notificationService.addNotificationListener {
notification ->if (!notification.relayedRequest.hasUpdateFriendRequestRequest()) {
return@addNotificationListener
}
val updateFriendRequestRequest = notification.relayedRequest.updateFriendRequestRequest
when (updateFriendRequestRequest.responseAction) {
ResponseAction.ACCEPT-> {
// do something when the recipient accepts the friend requests sent by the current user.
}
ResponseAction.DECLINE-> {
// do something
}
ResponseAction.IGNORE-> {
// do something
}
ResponseAction.UNRECOGNIZED-> {
throwIllegalArgumentException("Unrecognized response action: ${updateFriendRequestRequest.responseAction}")
}
}
}
Write a plugin to implement the interface im.turms.service.infra.plugin.extension.ClientRequestHandler for turms-service, and then you can do anything you want to view/modify the client request and response/notification in the plugin as you can control the code, you can control anything.
Almost all proto models include a field customAttributes, which is designed for developers to send any arbitrary data between the Turms clients and servers to implement your business logic.
作者你好。我的业务里面有个需求:当同意添加对方为好友时,业务系统需要执行一定的逻辑。这个IM怎么修改,通知到业务系统。能简单说一些吗?
The text was updated successfully, but these errors were encountered: