Client Connections

To accept connections from publishers or subscribers, an AMPS instance must have at least one Transport configured for client connections. The Transport must specify:

  • The network protocol used for the transport, called the transport type.

  • The network address, such as IP address and port, that the AMPS server will listen to for incoming connections.

  • Optionally, the AMPS command header format, called the protocol. The amps protocol is the default if no protocol is provided and is the protocol used by most applications. Websocket connections use the websocket protocol.

A transport can optionally set other parameters on the transport. This includes setting the authentication and entitlements that apply to connections for this transport, setting slow client parameters for the transport, and so forth.

TCP Connections

This is the most commonly used connection type for AMPS clients.

With this option, communication occurs over a standard TCP/IP connection.

TLS/SSL Connections

AMPS supports TLS/SSL connections between clients and servers. To enable SSL on a transport, you must:

  • Specify a transport Type of tcp or tcps, and

  • Provide a certificate and private key for the connection

You can optionally set other parameters for SSL connections, as described in the AMPS Configuration Guide.

60East recommends using the tcps transport Type for SSL connections for clarity. However, AMPS uses SSL connections for a tcp connection whenever a PrivateKey and Certificate are provided for a Transport, regardless of whether the transport Type is specified as tcp or tcps.

AMPS clients require that the connection string use tcps for SSL connections, even if the AMPS Transport configuration uses tcp.

IPv6 Connections

Starting with version 5.3.3, AMPS supports connections over both IPv4 and IPv6 IP protocols if the host has IPv6 support enabled.

Both IPv4 and IPv6 IP address formats are fully supported for use with specifying the network address of a transport. The IP protocol version used for a transport is determined by the network address format specified for the transport. If only a port is specified and the host supports IPv6, AMPS will listen for incoming connections over both IPv4 and IPv6 protocols.

For outgoing connections, such as Replication Connections, AMPS fully supports both IPv4 and IPv6 IP address formats. AMPS will prefer to resolve a URI to IPv4 addresses by default. The DNS resolution behavior can be specified as part of the configuration of the Replication Destination.

Specific parameters and behavior related to IPv4 vs IPv6 connections are described in the Transports section of the AMPS Configuration Guide.

Unix Domain Sockets

AMPS provides transports that use unix domain sockets for applications that run on the same system as the AMPS server and require extremely low-latency messaging. Unix domain sockets are not supported by all AMPS clients, since some programming environments do not support these sockets.

With this transport type, many of the configuration settings that apply to TCP/IP sockets are not relevant. Instead, the transport requires the name of a file on the local filesystem as the location at which to create the socket.

WebSocket Protocol Connections

To allow AMPS to be used directly from within browser-based applications, the AMPS server supports communication over WebSockets. An AMPS client Transport that uses tcp or tcps as the underlying Type can be configured to use the websocket Protocol for communication. The AMPS JavaScript client library supports websocket protocol connections to AMPS (while the other client libraries support amps protocol connections).

When a Transport is configured to use the websocket protocol, a client that connects to that transport sends an HTTP upgrade header indicating that further communication should use the WebSocket protocol. The AMPS server returns a response indicating that it is switching protocols to WebSocket, and further communication between the client and server uses the proprietary AMPS protocol exchanged within WebSocket frames. The contents of the frames are AMPS messages, as described in the AMPS Command Reference. There is no difference in capability between connections that use the websocket protocol and connections that use the AMPS protocol. The commands exchanged between the AMPS server and client are the same, although the "on wire" format within which the commands are exchanged is different.

A WebSocket connection to AMPS is a persistent, full-duplex connection to the server. A WebSocket connection is not a RESTful interface to AMPS, nor does the connection support HTTP beyond the initial upgrade request.

Last updated

Copyright 2013-2024 60East Technologies, Inc.