\TokenGetterForAlicom

接收云通信消息的临时token

Summary

Methods
Properties
Constants
__construct()
getTokenFromRemote()
getTokenByMessageType()
$
$
$
$
No constants found
No protected methods found
No protected properties found
N/A
getAccountEndpoint()
No private properties found
N/A

Properties

$

$ : array

tokenMap

Type

array

$

$ : integer

bufferTime 过期时间小于2分钟则重新获取,防止服务器时间误差

Type

integer

$

$ : string

mnsAccountEndpoint

Type

string

$

$ : \Aliyun\Core\DefaultAcsClient

acsClient

Type

\Aliyun\Core\DefaultAcsClient

Methods

__construct()

__construct(string  $accountId, string  $accessKeyId, string  $accessKeySecret) 

TokenGetterForAlicom constructor.

Parameters

string $accountId

AccountId

string $accessKeyId

AccessKeyId

string $accessKeySecret

AccessKeySecret

getTokenFromRemote()

getTokenFromRemote(string  $messageType,   $queueName) : \TokenForAlicom|boolean

远程取Token

Parameters

string $messageType

消息订阅类型 SmsReport | SmsUp

$queueName

Returns

\TokenForAlicom|boolean

getTokenByMessageType()

getTokenByMessageType(string  $messageType, string  $queueName) : \TokenForAlicom|boolean

先从tokenMap中取,如果不存在则远程取Token并存入tokenMap

Parameters

string $messageType

消息订阅类型 SmsReport | SmsUp

string $queueName

在云通信页面开通相应业务消息后,就能在页面上获得对应的queueName
(e.g. Alicom-Queue-xxxxxx-SmsReport)

Returns

\TokenForAlicom|boolean

getAccountEndpoint()

getAccountEndpoint(string  $accountId, string  $region, boolean  $secure = false, boolean  $internal = false, boolean  $vpc = false) : string

配置获取AccountEndPoint

Parameters

string $accountId

AccountId

string $region

Region

boolean $secure

是否启用https

boolean $internal
boolean $vpc

Returns

string —
  • http(s)://{AccountId}.mns.cn-beijing.aliyuncs.com
  • http(s)://{AccountId}.mns.cn-beijing-internal.aliyuncs.com
  • http(s)://{AccountId}.mns.cn-beijing-internal-vpc.aliyuncs.com