实现小程序内部接收服务端消息的需求,需求解决方案?

小程序 文章 2021-03-29 19:02 42 0 全屏看文

实现小程序内部接收服务端消息的需求,需求解决方案?Realize the needs of receiving server messages within the applet, and the solution to the needs?

实现小程序内部接收服务端消息的需求,需求解决方案?

需求:

Php服务端发送推送消息到小程序,小程序接收到通知后处理自定义动作,比如语音提示,比如刷新页面,弹出页面

问题:

小程序有无相关接口的调用,或者有无第三方支持的插件,或者其他解决方案

Requirements: the PHP server sends push messages to the small program, and the small program processes custom actions after receiving the notification, such as voice prompts, such as refreshing the page and popping up the page. Problems: whether the small program has related interface calls, or whether there are plug-ins supported by a third party, or other solutions

回答:

鲤子:

用长链接,如websocket,UDP。或者轮询,不推荐,太消耗资源了。

Likun:

小程序没有提供类似的接口,不过你也可以使用WebSocket来实现。

-EOF-