如何将FCM与Ejabberd集成? [英] How to Integrate FCM with Ejabberd?

查看:98
本文介绍了如何将FCM与Ejabberd集成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


环境:

Ejabberd版本:16.04

Ejabberd Version : 16.04

Smack-android-4.1 .0

Smack-android-4.1.0

我已经使用XMPP服务器创建了一个Android聊天应用程序。但是由于Google Play许可问题,我不得不缩小应用程序的功能,该功能支持在后台运行时接收传入的消息通知。

I have created an Android chat application with a XMPP server. However due to Google play permission issue I had to narrow down the feature from app which supported receiving incoming message notifications when the app is in the background.

作为替代方案,我收到了以下建议: GooglePlay审核小组。

As an alternative I received the following suggestion from GooglePlay Review Team.


一旦您删除了此权限,如果您的应用需要传递消息,则可以考虑使用Firebase
云消息传递(FCM)暂时免除电池优化费用。仅当消息是时间紧迫的并且需要用户的
立即交互时,才设置
的高优先级,并且请注意,与正常优先级相比,将消息设置为
的高优先级会消耗更多电池
消息

Once you’ve removed this permission, you might consider using Firebase Cloud Messaging (FCM) if your app’s message delivery requires a temporary exemption from battery optimization. Please set high priority only if the message is time-critical and requires the user’s immediate interaction, and be aware that setting your messages to high priority contributes to more battery drain compared to normal priority messages

因此,目前用户可以通过该应用发送消息。但是,当他关闭应用程序时,他将被视为离线用户,并且不会收到来自应用程序的任何通知。当他再次打开该应用程序时,他将获得保存在Ejabberd服务器上的所有脱机消息。

So at the moment users can send messags via the app. But when he close the app, he will be considered as an offline user, and will not receive any notifications from app. When he opens the app again, he will get all the offline messages those were saved the Ejabberd server.

我想增强当前应用程序,以便即使用户已关闭该应用程序,他当有人向他发送消息时,他仍然会收到通知(类似于whatsapp)

I want to enhance the current app so that even though a user had closed the app he will still receive a notification when some one sends a message to him (Similar to whatsapp)


  1. ejabberd中是否有一个模块将服务器与FCM并处理此问题?

  1. Is there a module in ejabberd which integrates the server with FCM and handles this?

如果我们无法通过Ejabberd实现此功能,是否有第3方库来支持此操作?

If we can not achieve this by Ejabberd, is there a 3rd party library to support this?

如果不是,我们是否必须从头开始编写Erlang模块?

If not do we have to write an Erlang module from scratch?

我在互联网上发现了类似的问题,但找不到任何可行的解决方案。由于我对Erlang的了解不多,因此很高兴听到您对此的解决方案/想法。

I found similar questions in the internet but I could not find any working solution. Since I am not much experienced with Erlang and would be glad to hear your solutions/ideas on this. Thanks in advance.

推荐答案

可以在Ejabberd中使用offline_message_hook来实现。发送消息到接收方和处于脱机状态的接收方时,将触发此挂钩。因此,使用此钩子创建自定义模块,然后可以向FCM和APNs服务器发送推送通知。
推荐此博客- https://jasonrowe.com/ 2011/12/30 / ejabberd-offline-messages /

This can be achieved in Ejabberd with offline_message_hook. This hook is trigger when sending a message to the receiver and receiver in an offline state. So create a custom module using this hook and you can send a push notification to FCM and APNs servers. Refer this blog -- https://jasonrowe.com/2011/12/30/ejabberd-offline-messages/

这篇关于如何将FCM与Ejabberd集成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆