{'fraction_non_alphanumeric': 0.0314256515074093, 'fraction_numerical': 0.008260943621188895, 'mean_word_length': 4.751898114131766, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
IVOA Recommendation: VOEvent Transport Protocol Version 2.0

The IVOA VOEvent Recommendation defines a means of describing transient celestial events but, purposely, remains silent on the topic of how those descriptions should be transmitted. This document formalizes a TCP-based protocol for VOEvent transportation that has been in use by members of the VOEvent community for several years and discusses the topology of the event distribution network. It is intended to act as a reference for the production of compliant protocol implementations.


Introduction
The VOEvent standard (Seaman and Williams et al., 2011) defines a means of representing transient celestial events with an implicit request for action on the part of the recipient. The VOEvent standard is transport neutral: it does not take a position on the mechanism by which the event should be transmitted from its author to interested recipients. However, it encourages the construction of "a robust general-purpose network of interoperating brokers" for event transmission.
To date, a number of different event distribution networks have been prototyped and met with varying degrees of technical success and community adoption. However, as the number of interested participants grows, and next-generation large-scale survey instruments such as LSST 1 , LIGO 2 , LOFAR 3 and SKA 4 , which promise event rates ranging up to the millions per day, are developed and begin to become available, it is clear that a standard, interoperable mechanism for event communication is required. It is such a mechanism that this document describes.
The purpose of the protocol described herein is to transport a VOEvent document from its sender to one or more interested recipients. To achieve this, we envision three distinct network roles: authors, which create events; brokers, which receive events from authors and distribute them, and subscribers, which receive and (if appropriate) act upon the events. Refer to Figure 1 for an illustration, while Figure 2 shows how this integrates with the wider IVOA architecture. Note that a single entity may perform more than one role within the network: for example, creating events and distributing its own creations (combining the author and broker roles) or receiving events from a broker and redistributing them to a list of subscribers (combining the subscriber and broker roles). Building upon this architecture, a strongly-connected set of brokers which subscribe to each other's event streams and redistribute to their subscribers (the "VOEventNet backbone") provides a fault-tolerant system which is resilient against the failure of one or more network entities. Such a backbone system is already under construction by members of the VOEvent community.
The protocol described herein is intentionally as simple as possible while still accomplishing the required task. More complex protocols will be required for addressing advanced use-cases, handling extremely large event or subscriber numbers 5 , or providing value added services 6 . These fall outside the scope of the current document.
Although this document refers specifically to VOEvents, the protocol places only quite minimal requirements on the payload. We expect that a future evolution of this protocol would provide a convenient means of delivering diverse message types, perhaps including portfolios or containers of VOEvents, or even non-IVOA standard messages.

Terminology
Throughout this document, we adopt the terminology of RFC 2119 (Bradner, 1997). In particular: • The word "must" indicates an absolute requirement of the specification; • The word "should" indicates behaviour that is normally included in implementations of the specification, but there may exist valid reasons for excluding it in particular circumstances; • The word "may" indicates purely optional behaviour which is permitted according to this specification.

Design goals
The VOEvent Transport Protocol, hereafter VTP, provides a simple means of transporting VOEvent documents from authors through brokers to subscribers. VTP transmits no more than one VOEvent in each transaction. If multiple documents are to be transmitted, multiple transactions must take place.
VTP delivers VOEvents to eligible subscribers which exist on the network at the time of transmission. It does not buffer events for later transmission. Subscribers who wish to retrieve historical events should consult an event repository.
VTP is non-transformational on VOEvents being transmitted: the document delivered to a subscriber should be bit-for-bit identical to that provided by an author. If an intermediary wishes to modify or annotate the VOEvent, they should not edit the document in transport, but rather generate a new document to supplement or replace it.
VTP does not provide a transport-level means of annotating or otherwise embellishing VOEvent documents, or of providing stream-level metadata.
VTP values simplicity of design and operation to lower the barrier to entry. It is not intended to meet every use case. As per Section 1, it is anticipated that some VOEventbased services will require more complex protocols.
VTP is independent of implementation: conforming network entities should be able to interoperate seamlessly, even when derived from different codebases.

Network layer
VTP operates over TCP (Cert and Kahn, 1974) connections, and relies on TCP's guaranteed error-free in-order delivery of data: no checksum or digest data is included. All documents are sent over the TCP connection preceded by a 4-byte network-ordered 7 count, followed immediately by the payload data. The 4-byte count is interpreted as a 32-bit integer equal to the number of payload bytes following the count bytes. The payload is considered an opaque collection of bytes at this level 8 .

Message format
Throughout this document, the term "message" refers to a complete VTP message, including both the initial byte count and the message payload. The payload is an XML document. It must consist of an XML declaration followed by, in order, optional XML comments, a single <VOEvent /> or <Transport /> 9 element, and more optional XML comments. It must validate against either the VOEvent XML schema 10 or the Transport XML schema (Appendix A). Messages may be conveniently referred to by their payload type (viz. "VOEvent message", "Transport message").

Broker behaviour
Although the simplest broker implementation may simply forward all unique events it receives, either directly from authors or from other brokers, to all of its subscribers, this behaviour is not required. Instead, the broker may provide "added-value" services which limit how messages are redistributed. For example, a broker may make arrangements with some or all of its subscribers to filter the events it receives, and forwarding only those events that fulfil some predefined criteria. Similarly, brokers may limit access to some clients based on various criteria ( §9).
VTP does not provide in-band notification of these per-broker details. For example, the protocol does not make an author submitting to a filtering broker aware that their event might not be sent to all of the broker's subscribers, and, similarly, it does not make a subscriber of a filtering broker aware that they might not receive a complete set of events. It is the responsibility of authors and subscribers to ensure that the brokers they use provide the services they require. Brokers should clearly advertise any added-value behaviour they provide, for example on a website or through the IVOA registry (Arviset and Gaudet et al., 2010).

Network nodes
The VOEvent network consists of three types of nodes (refer to Fig. 1): • Author • Broker

• Subscriber
As described in Seaman and Williams et al. (2011), it is expected that authors and brokers will be registered with the IVOA registry 11 . It is not necessary for subscribers to register.
The flow of messages is over three types of connections: • Author to Broker 9 <Transport /> elements are used by the VTP system itself and are invisible to end-users: see Section 6 for details.
10 http://www.ivoa.net/xml/VOEvent/VOEvent-v2.0.xsd 11 This is dependent on the VOEvent Registry Extensions (Graham and Williams et al., 2014), which are not fully standardized or widely deployed at time of writing. Unregistered services may therefore be deployed until such time as the relevant registry support becomes available.

• Broker to Subscriber
• Broker to Broker Each type of connection is discussed qualitatively below.

Author to Broker
When an author wants to submit a VOEvent document to the network, it constructs a message encapsulating that document, opens a TCP connection to a broker, sends the message, waits for a response from the broker, and then closes the TCP connection. The response from the broker is a message containing a Transport document.

Broker to Subscriber
When a subscriber wants to receive VOEvent traffic, it opens a TCP connection to a broker. This connection is kept open continuously. When the broker receives a VOEvent message, it relays a copy of that message to each connected subscriber 12 . Thus, a subscriber must continuously listen on the TCP connection and be prepared to receive new messages at any time, even when it is busy processing a previously received message. When a subscriber receives a VOEvent message from its broker, it must respond with an appropriate Transport message.

Broker to Broker
Traffic between brokers uses the preceding methods. Each broker takes the role subscriber as far as every other broker is concerned. A broker that wishes to receive a feed from another broker should connect to that broker's subscriber port. No special protocol features are needed.

Connection Maintenance
All connections over which a broker sends VOEvent messages are kept open continuously. However, basic TCP does not provide any dead-peer indication 13 . Further, network infrastructure devices might sever a TCP connection after some period of inactivity. This gives rise to the need for keep-alive messages. After no more than 90 seconds of inactivity on any given connection, the broker must send a Transport iamalive message, to which the subscriber must reply with a copy of that message plus some optional identification information. The message format is described in Sections 6.1 and 6.2.
At both ends of the continuous connection, the node either expects to receive an iamalive message or expects to receive the response to its iamalive message. If not seen, the node should assume that the connection has been lost or the peer is dead. At this point, the node that was responsible for opening the connection may attempt to re-initiate it. The use of geometric back-off algorithm may help alleviate network load. 12 If filtering as described in §3.4 is being carried out, the message may be sent only to a subset of the subscribers.
13 TCP does support a "keep-alive" service, but it is not universally available (Braden, 1989).
All Transport messages have the same general syntax, and are defined by the Transport schema (Appendix A). The connection maintenance and receipt acknowledgement message types are described in detail in this section; the authentication message type has a special role which is described in Section 9.2.

iamalive message
The iamalive message is indicated by a role equal to iamalive. The <Origin /> element contains the IVOID 14 of the broker which is managing the connection. The <TimeStamp /> element contains the date and time at which the message was generated formatted as per §3.3.7 of Peterson et al. (2012). This time should be provided in UTC, and may include a "Z" timezone indicator.

iamalive response
The iamalive response is an extension of the initial iamalive message. It also has a role of iamalive. The <Origin /> element is preserved unchanged from the iamalive being responded to (that is, it contains the IVOID of the broker). It may include an additional <Response /> element containing a URI identifying the subscriber 15 . It may also include a <Meta /> element with <Param /> sub-elements which give additional information about the subscriber or any other relevant information. <Param /> elements have no content and must contain name and value attributes. The names and values may be any string. The <TimeStamp /> element contains the date and time at which the response was generated, formatted as per §3.3.7 of Peterson et al. (2012). This time should be provided in UTC, and may include a "Z" timezone indicator.

VOEvent message receipt response
The VOEvent message receipt response is similar to the iamalive response except the role is either ack or nak, the <Origin /> is the IVOID of the just-received VOEvent message, and an optional <Result /> element may accompany the <Param /> elements. <Result /> may contain any string; it is recommended that it contain a human-readable error message if role is nak. The <TimeStamp /> element contains the date and time at which the response was generated, formatted as per §3.3.7 of Peterson et al. (2012). This time should be provided in UTC, and may include a "Z" timezone indicator.
The nak response indicates that the recipient is unable or unwilling to take responsibility for this message. This may be because, for example, the message fails to validate as a valid VOEvent, or because it was received from an unauthorized client ( §9). A nak response is not appropriate if the sender is able to accept the message but then decides not to redistribute it (for example, if it is a duplicate of an event which has already been distributed: Section 8).
A nak response should be regarded as a permanent failure state: delivery of the VO-Event message which was met with the nak to the recipient which replied with the nak should be aborted. If the VOEvent message was being transmitted over an author-tobroker connection, the author may identify the cause of the failure (for example by making use of the information in the <Meta /> element of the nak), construct a corrected VOEvent message and attempt a repeat submission. If the VOEvent message was being transmitted over a broker-to-subscriber connection, the broker should abandon the attempt to deliver this message.

Protocol operation
This section describes the operation and sequencing of VTP operation for each end of a connection between an author and a broker, as well as between a broker and a subscriber. See Section 4 above for a qualitative discussion of the protocol from the viewpoint of each entity.

Author sending to broker
The author initiates a TCP connection to the broker. The broker may choose to accept or reject that connection based, for example, on an access control whitelist ( §9.1). If the author is rejected, the connection is terminated. If the connection is accepted, the author creates a VOEvent message by prepending a byte count to the VOEvent document ( §3.3) and transmits it to the broker. The author should then wait for a VOEvent message receipt response ( §6.3) from the broker. The author may use this to determine whether the message has been successfully delivered. The connection is then closed.
If a receipt response is not received, the author should assume that a temporary failure has prevented the broker from accepting the message for distribution. The author may close the connection and retry.
This transaction is illustrated in Figure 3.

Broker receiving from author
The broker awaits incoming TCP connections from authors. When a connection is received, the broker may choose to accept or reject the connection based, for example, on an access control whitelist ( §9.1). If the author is rejected, the connection is terminated. Otherwise, the broker waits to receive a VOEvent message from the author. When the VOEvent is received, the broker should test the message for validity. The broker must return a VOEvent message receipt response ( §6.3) to the author indicating that it has either accepted (ack) or refused (nak) the VOEvent message. The connection is then closed.
This transaction is illustrated in Figure 4.

Broker sending to subscriber
The broker awaits incoming TCP connections from subscribers. When a new connection is received, the broker may choose to accept or reject the connection based, for example, on an access control whitelist ( §9.1). If the subscriber is rejected, the connection is terminated. Otherwise, the broker adds the subscriber to its distribution list. Periodically, at intervals of no more than 90 s ( §5), the broker must send an iamalive message ( §6.1) to the subscriber. The subscriber must reply with an iamalive response ( §6.2). If the broker does not receive iamalive response messages from the subscriber in a timely fashion, it may assume that the subscriber is dead or gone and close TCP

connection.
When the broker has a new VOEvent message ready for distribution, it is sent to the subscriber. The broker receives a VOEvent message receipt response ( §6.3) in reply. The broker may use this to determine whether the VOEvent message has been accepted (ack) or refused (nak). The broker must not attempt to repeat delivery of the message if a nak is received.
If a receipt response is not received, the broker should assume that a temporary failure has prevented the subscriber from accepting the message. The broker may attempt redelivery. At the discretion of the broker, repeated failures to receive timely receipt responses may be grounds to terminate the connection.
The TCP connection remains open, and the iamalive exchange continues, until either the subscriber explicitly closes the connection or stops sending iamalive response messages, thereby implicitly indicating that the connection is closed.
These transactions are illustrated in Figure 5.

Subscriber receiving from broker
The initiates a TCP connection to the broker. The broker may choose to accept or reject that connection based, for example, on an access control whitelist ( §9.1). If the subscriber is rejected, the connection is terminated. Otherwise, the connection remains open, and the subscriber begins receiving messages.
Periodically, at intervals of no more than 90 s ( §5), the subscriber should expect to receive an iamalive message ( §6.1) from the broker. The subscriber must reply with an iamalive response ( §6.2). If the subscriber does not receive iamalive messages from the broker in a timely fashion, it may assume that the broker is dead or gone and close TCP connection. The subscriber may attempt to re-connect to the broker. Re-connection attempts should use a geometric back-off algorithm.
When a VOEvent message is received, the subscriber may test it for validity. The subscriber must return a VOEvent message receipt response ( §6.3) to the broker indicating that it has either accepted (ack) or refused (nak) the VOEvent message.
The TCP connection remains open, and the iamalive exchange continues, until either the subscriber explicitly closes the connection or stops receiving iamalive messages, which indicates that the connection has been terminated.
These transactions are illustrated in Figure 6.

De-duplication
In a network topology like that illustrated in Figure 1, multiple brokers service potentially overlapping sets of authors and subscribers. As per Sections 1 and 4.3, brokers will subscribe to each other's event feeds to ensure that their subscribers have access to the full range of available events. In this situation, there is a risk of event loops developing on the network: broker A receives an event from B and forwards it to its subscriber list, which includes A, which forwards it to its subscriber lists, which includes B, and so on. In order to prevent this, each broker must process each unique VOEvent message it receives a maximum of once.
Note that it is now established practice to distribute different descriptions (e.g. VO-Event 1.1 and 2.0) of the same celestial event with the same IVOID 16 . Consequently, an IVOID is not a unique identifier of a particular VOEvent message, and is not, therefore, suitable for use in network de-duplication.
Instead, we regard two messages as being the same if the content between the opening < and the closing > of the <VOEvent /> element is bit-for-bit identical, including all white space characters. The implementation of this check is left to the discretion of the broker 17 .
In the event that some future revision of the VOEvent standard adopt an identifier which is unique to the message, rather than to the celestial event, it would be preferable to use that for de-duplication rather than calculating a hash over the event content.
Two mechanisms are may be applied within the VTP framework to address these requirements.

IP address whitelisting
If the broker knows a priori the IP addresses or ranges from which authorized authors or subscribers are permitted to connect (a "whitelist"), it may simply deny connections from addresses which fall outside that range. If the sets of authorized authors and subscribers are not the same, separate whitelists may be implemented.
This mechanism imposes significant administrative overhead on the broker owner if large and complex whitelists are required. Further, it is of limited applicability if the clients to be serviced are using dynamic IP addresses (that is, addresses which change periodically).

Cryptographic signatures
A digital signature scheme enables the recipient of a digital message to verify the identity of its author (Diffie and Hellman, 1976). By requiring authors and subscribers to apply appropriate signatures to VOEvent and Transport messages, it may be possible for a broker to verify their identity and restrict the services made available to them.
Various digital signature schemes which are appropriate for use with VOEvent and other XML documents have been suggested (Allen, 2008;Denny, 2008). At time of writing, none have seen significant adoption. Given that, this version of the VTP standard does not specify a particular approach, nor require that any form of cryptographic authentication be available. However, the <Transport /> schema provides an <authenticate> message type, shown in Listing 5, which may be used to implement either the Allen or Denny scheme, or as the basis for some other approach.
See also Major and Rixon et al. (2016) for a description of the authentication schemes available for use across the Virtual Observatory.
• Describe appropriate actions when a receipt response message is not received ( § §7.1 & 7.3).
B.3 Revised since IVOA Note v1.1 • Add Section 3.1, describing design goals of the protocol.
• Add Section 8, detailing requirements for message de-duplication to avoid network loops.
• Specify an explicit interval requirement to connection maintenance messages ( §5).
• Make it explicit that brokers should not attempt to repeat delivery of messages which meet with a nak on the first attempt: VTP does not support the concept of a "temporary failure" ( § §6.3, 7.3).
• Reword the descriptions of protocol operation so that they describe only the traffic exchanged over the network and not the implementation of the various entities ( §7).
B.4 Revised since IVOA Note v1.0 • Add an optional <Result /> sub-element (containing text) within the optional <Meta /> element. This is intended to convey details on errors encountered if the Transport response is nak but may also be used for informational purposes in ack messages.