Overview

Namespaces

  • None
  • sinacloud
    • sae

Classes

  • SaeADPNS
  • SaeAPNS
  • SaeChannel
  • SaeDeferredJob
  • SaeFetchInternal
  • SaeKV
  • SaeMail
  • SaeMysql
  • SaeSegment
  • SaeTAdvance
  • SaeTaskQueue
  • SaeTClientV2
  • SaeTOAuthV2
  • SaeVCode
  • vDisk

Exceptions

  • OAuthException
  • Overview
  • Namespace
  • Class

Class SaeChannel

SAE Channel 服务

Demo 地址:https://github.com/sinacloud/sae-channel-examples/tree/master/php

<?php
$channel = new SaeChannel();
$connection = $channel->createChannel('test',100);
$message_content = 'hello,sae';
// Send message
$ret = $channel->sendMessage('test',$message_content);

?>

错误码参考: - errno: 0 成功 - errno: 101 参数错误 - errno: 500 服务内部错误

SaeObject
Extended by SaeChannel
Package: sae
Author: Lazypeople lazy@changes.com.cn
Located at saechannel.class.php
Methods summary
public
# __construct( )
public string
# createChannel( string $name, integer $duration = 3600 )

创建一个channel信道

创建一个channel信道

Parameters

$name
channel的名称
$duration
channel的有效时间,单位为秒,默认为1小时

Returns

string

Author

Lazypeople
public boolean
# sendMessage( string $name, string $message, boolean $async = False )

发送一条消息

发送一条消息

上行发送一条消息,向客户端推送消息,最大可以发送4k的消息,最好不要直接发送二进制的数据。

Parameters

$name
channel的名称
$message
需要发送的消息内容
$async
是否返回消息发送的结果,如果设置为true,服务端会立刻返回(始终返回成功)

Returns

boolean

Author

Lazypeople
public string
# errmsg( )

取得错误信息

取得错误信息

Returns

string

Author

Lazypeople
public integer
# errno( )

取得错误码

取得错误码

Returns

integer

Author

Lazypeople
Constants summary
string end_
# 'http://channel.sae.sina.com.cn:81/v1/'
integer MAXIMUM_CLIENT_ID_LENGTH_
# 256
integer MAXIMUM_TOKEN_DURATION_SECONDS_
# 7200
integer MAXIMUM_MESSAGE_LENGTH_
# 4096
API documentation generated by ApiGen