as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
Ring
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持
原生
Skip to main content

Constructors

new AmazonDeviceMessagingServer()

new AmazonDeviceMessagingServer(): AmazonDeviceMessagingServer

Returns

AmazonDeviceMessagingServer

Methods

getMajorVersion()

static getMajorVersion(): number

Returns

number

getMinorVersion()

static getMinorVersion(): number

Returns

number

getPatchVersion()

static getPatchVersion(): number

Returns

number

registerAsync()

static registerAsync(): Promise<string>
Register the client app with the ADM cloud, allowing the app to receive ADM messages. A Promise from which the app’s registration ID can be retrieved.

Throws

  • AmazonDeviceMessagingError. Default exception with an error message.

Returns

Promise<string>

registerHandler()

static registerHandler(handler: AmazonDeviceMessagingHandler): void
Register a message handler with the AmazonDeviceMessagingServer. This handler will be invoked to handle incoming ADM messages.

Parameters

handler
AmazonDeviceMessagingHandler The client app’s message handler.

subscribeToTopicAsync()

static subscribeToTopicAsync(topic: string): Promise<void>
Subscribe the client app to a topic for topic-based messaging. The app will receive ADM messages sent to this topic.

Parameters

topic
string The topic to subscribe to.

Throws

  • AmazonDeviceMessagingError. Default exception with an error message.
  • InvalidArgumentError. If topic name doesn’t follow the pattern [a-zA-Z0-9-_.~%]{1,100}

Returns

Promise<void>

unregisterAsync()

static unregisterAsync(): Promise<string>
Unregister the client app from the ADM cloud. The app will no longer receive ADM messages. A Promise from which the previous (now unregistered) registration ID can be retrieved.

Throws

  • AmazonDeviceMessagingError. Default exception with an error message.

Returns

Promise<string>

unsubscribeFromTopicAsync()

static unsubscribeFromTopicAsync(topic: string): Promise<void>
Unsubscribe the client app from a topic for topic-based messaging. The app will stop receiving ADM messages sent to this topic.

Parameters

topic
string The topic to unsubscribe from.

Returns

Promise<void>

waitForMessageHandlerCompletionAsync()

static waitForMessageHandlerCompletionAsync(timestamp: Date): Promise<Object>
Method used to wait for the completion of message handling.

Parameters

timestamp
Date

Returns

Promise<Object>

wrapHandleOnMessage()

static wrapHandleOnMessage(handler: AmazonDeviceMessagingHandler, message: AmazonDeviceMessagingMessage, id: number): Promise<void>
A wrapper method that waits for the client applications’ message handler to handle the ADM message, and resolves/rejects the promise correlated to the message based on the response from the handler.

Parameters

handler
AmazonDeviceMessagingHandler
message
AmazonDeviceMessagingMessage
id
number

Returns

Promise<void>

Examples

Last modified on November 4, 2026