定制 homer/yunba-push 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

homer/yunba-push

Composer 安装命令:

composer require homer/yunba-push

包简介

Message pushing implementation with yunba as backend

README 文档

README

Use Restful APIs exposed by Yunba to implement message pushing service.

This service provides only the most basic features, and designated to be integrated into other project as infrastructure.

use Homer\Push\Yunba\Service as YunbaPushService;

$service = new YunbaPushService('appkey', 'secretkey');
// - or the full version
// $service = new YunbaPushService('appkey', 'secretkey', $optionsOfService, $instanceOfClient);

// push to topic
$service->pushToTopic('topic', 'message', $options);
$service->pushToTopicAsync('topic', 'message', $options);

// push to alias
$service->pushToAlias($alias_or_aliases, 'message', $options);

// check async topic message status
$service->checkAsyncTopicMessage('topic', 'message_id');

API

construct

__construct($appKey, $secretKey, array $options = null, ClientInterface $client = null)

  • $appKey app key (from Yunba portal)
  • $secretKey secret key (from Yunba portal)
  • $options some configurations, including:
    • url (optional)yunba's url, default to 'http://rest.yunba.io:8080'
    • alias_size (optional) maximum #. of aliases in a batch. Yunba suggests that no more than 1000 aliases in a batch is preferred. default to 800.
  • $client http client

push message to topic

You can push a topic, and those who subscribed that topic will receive the message (it follows the publish/subscribe pattern). You can do that in either asynchrounous or synchrounous manner.

pushToTopic($topic, $message, array $options = []) pushToTopicAsync($topic, $message, array $options = [])

  • $topic topic to push message to
  • $message message to push
  • $options options for Yunba's 'publish' or 'publish_async' method
  • return string message id

Note: The message given will be pushed as a whole, even if it's an array. Call this method multiple times if you want to push multiple messages. For example, pushToTopic($topic, ['message1', 'message2']) won't push two messages to the topic, but one message with its content as '["message1","message2"]', which is just a plain JSON string.

push message to alias

This is how Yunba sends uni- and multi-cast messages(while pushing message to topic sends broadcast).

pushToAlias($alias, $message, array $options = [])

  • $alias alias to push message to
  • $message message to push
  • $options options for Yunba's 'publish_to_alias' or 'publish_to_alias_batch' method
  • return string|array depending on whether you're pushing message to one or more aliases

check async topic message

Check status of messages that pushed via topic in async manner.

  • $topic the topic
  • $messageId id of the message being checked
  • return string status of the message. Refer to Yunba's doc for detail.

Reference

Yunba's Restful Quick Start

统计信息

  • 总下载量: 2.12k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2016-03-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固