LogoLogo
AMPS JavaScript Client 5.3.4
AMPS JavaScript Client 5.3.4
  • Welcome to the AMPS JavaScript Client
    • Before You Start
    • Obtaining and Installing the JavaScript Client
    • Your First AMPS Program
      • Client Identification
      • Connection Strings For AMPS
      • Providing Credentials to AMPS
    • Subscriptions
      • Content Filtering
        • Changing the Filter on a Subscription
      • Understanding Message Objects
      • Promises and Message Handlers
      • Regular Expression Subscriptions
      • Ending Subscriptions
    • Error Handling
      • Disconnect Handling
        • Using a Heartbeat to Detect Disconnection
        • Managing Disconnection
        • Replacing Disconnect Handling
      • Unhandled Errors
    • State of the World
      • SOW and Subscribe
      • Setting Batch Size
      • Managing SOW Contents
    • Using Queues
      • Backlog and Smart Pipelining
      • Acknowledging Messages
      • Acknowledgment Batching
      • Returning a Message to the Queue
      • Manual Acknowledgment
    • Delta Publish and Subscribe
      • Delta Subscribe
      • Delta Publish
    • High Availability
    • AMPS Programming: Working with Commands
    • Message Types
    • Advanced Topics
    • AMPS Server Documentation
    • API Documentation
Powered by GitBook

Get Help

  • FAQ
  • Legacy Documentation
  • Support / Contact Us

Get AMPS

  • Evaluate
  • Develop

60East Resources

  • Website
  • Privacy Policy

Copyright 2013-2024 60East Technologies, Inc.

On this page
  • Header Properties
  • Message Data
  • Message Field Reference
Export as PDF
  1. Welcome to the AMPS JavaScript Client
  2. Subscriptions

Understanding Message Objects

PreviousChanging the Filter on a SubscriptionNextPromises and Message Handlers

Last updated 3 months ago

So far, we have seen that subscribing to a topic involves working with objects of the Message type. A Message represents a single message from an AMPS server, while a Command is sent to a server. Commands are sent and messages are received for every client/server operation in AMPS.

Header Properties

There are two parts of each message in AMPS: a set of headers that provide metadata for the message, and the data that the message contains. Every AMPS message has one or more header fields defined. The precise headers present depend on the type and context of the message. There are many possible fields in any given message, but only a few are used for any given message. For each header field, the Message object contains a distinct method that allows for retrieval of that field. For example, the Message.header.commandId() corresponds to the CommandId header field, the Message.header.batchSize() corresponds to the BatchSize header field, and so on. For more information on these header fields, consult the AMPS User Guide and AMPS Command Reference.

Message class represents messages received from an AMPS server. When creating a message to be sent, the Command class is used. To work with header fields, a Command contains a set of <propertyName>() methods, which work as both setters and getters, allowing to chain command properties when creating a new command.

Message Data

Received message data is contained in the Message.data property. The data property will contain the parsed data of the message.

The AMPS JavaScript client contains a collection of helper classes for working with message types that are specific to AMPS (for example, JSON, FIX, NVFIX, and AMPS composite message types). You can replace default parsers to implement required specific behavior, as well as add new helpers.

Message Field Reference

The contains a full description of which fields are available and which fields are returned in response to specific commands.

AMPS Command Reference