简体   繁体   English

发送ejabberd推送通知(django)

[英]send ejabberd push notification ( django )

I have integrated ejabberd for chat functionality. 我已经集成了ejabberd以实现聊天功能。 Apps backend is in python-django and frontend is in IOS. 应用程序后端在python-django中,前端在IOS中。 current flow is as follows : 电流如下:

  1. When user signup into my app, A record has been created for that user in ejabberd server. 当用户注册到我的应用程序时,已经在ejabberd服务器中为该用户创建了一条记录。 This thing is handled in backend. 这件事在后端处理。 unique id for that user is the combination of primary key and name ( eg - 123_mark@xyz.com ) 该用户的唯一ID是主键和名称的组合(例如-123_mark@xyz.com)

  2. To chat on frontend , IOS is using these id's. 为了在前端聊天,IOS正在使用这些ID。 When both users are online , they can chat successfully. 当两个用户都在线时,他们可以成功聊天。

Problem - When a user gets offline or a user kills the application, Then backend has to send notifications to device. 问题-当用户脱机或杀死应用程序时,后端必须向设备发送通知。 I have checked ejjaberd's documentation. 我已经检查了ejjaberd的文档。 According to them I have to use mod_zeropush to send notifications. 根据他们的说法,我必须使用mod_zeropush发送通知。 I have checked some articles, but I am not sure how to send notification to users. 我已经查看了一些文章,但不确定如何向用户发送通知。 Can someone explain it in detail. 有人可以详细解释。

As far as I can see ZeroPush mod leverages a ZeroPush server, I might be wrong about this as I just glanced through their pages. 就我所看到的ZeroPush mod利用ZeroPush服务器而言,我可能浏览了他们的页面,对此可能是错误的。

What you need to do is to create your own mod which hooks into events that are occurring in ejabberd. 您需要做的是创建自己的mod,该mod挂接到ejabberd中发生的事件中。 This Q&A sums it up: How to develop custom functions on top of Ejabberd? 这个问答总结了: 如何在Ejabberd上开发自定义功能?

Basically you need to find out which event is fired when a user disconnects and hook into that event so your mod would be executed. 基本上,您需要找出当用户断开连接并挂接到该事件时将触发哪个事件,以便执行您的mod。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM