4lan/dms-php-sdk

一个简单的奥点云DMS PHP SDK

v1.0.0 2015-04-10 06:46 UTC

This package is not auto-updated.

Last update: 2024-10-02 08:51:51 UTC


README

##关于DMS DMS 是杭州奥点科技提供的一个双向消息推送服务,提供了js,php,c++,nodejs,shell,java,python,android,ios之间相互通信的功能,是市面上唯一支持低版本IE消息推送的服务

###PHP SDK PHP SDK 提供了向DMS推送消息的功能,由于常规PHP一般运行在http模式,只有很短的生存周期,所以只提供了发布功能。

###使用条件

  • PHP版本 > 5.3
  • 能连接到DMS服务器(公网)

###安装

  • 使用composer 安装库4lan/dms-php-sdk,命名空间dms
  • 或者直接下载文件,放在调用代码目录下
include(".dms_php_sdk/phpMQTT.php");
include(".dms_php_sdk/Pusher.php");

###使用 新建pusher对象,传入dms的publish key 和subscribe key

use dms;//at head
$pusher= new Pusher('your pub key','your sub key');

推送数据

$data=["user"=>"wangdachui","message"=>"can you hear me?"];//这里用了php5.4的语法,如果使用5.3请用array替换。
$pusher->trigger('a_topic',json_encode($data));