On Subscribe or Unsubscribe

AMPS provides modules for running actions when a client subscribes or unsubscribes.

The amps-action-on-subscribe runs actions when an AMPS client enters a subscription command. The amps-action-on-unsubscribe runs actions when an AMPS client unsubscribes (either by sending an explicit unsubscribe command or by disconnecting).

These modules require the following parameters:

ParameterDescription

Topic (required)

Specifies the topic or topic regular expression pattern to monitor for subscribe commands.

MessageType (required)

The message type of the topic to monitor for subscribe or unsubscribe. There is no default for this parameter.

These modules add the following variables to the AMPS context:

VariableDescription

AMPS_TOPIC

The name of the topic specified by the subscribe or unsubscribe command.

AMPS_CLIENT_NAME

The name of the client submitting the command.

AMPS_OPTIONS

The options on the subscription.

AMPS_FILTER

The filter for the subscription.

Last updated

Copyright 2013-2024 60East Technologies, Inc.