Train Movements

The Train Movements feed contains data from Network Rail's TRUST system. This reports on the progress of trains along their journey.

There's a fuller description of the process available.

= Message Topics =

Train movement messages are available through ActiveMQ TOC-specific topics, as well as an 'all TOCs' topic.

Message types
The feed contains eight message types, all in JSON format:


 * 0001 - Train Activation
 * 0002 - Train Cancellation
 * 0003 - Train Movement
 * 0004 - Unidentified Train (Not used in production)
 * 0005 - Train Reinstatement
 * 0006 - Change of Origin
 * 0007 - Change of Identity
 * 0008 - Change of Location (Not used in production)

Delay Attribution-related messages are not available.

NOTE - A Train Activation message will always be the first message to be received for a train, after which any of the other message types may be received.

Format
Each message is represented as a JSON hash with two keys - 'header' and 'body'. Zero or more of these messages is sent out in a JSON list, either every five seconds or when there are 32 messages to be sent. It is perfectly legitimate to receive an empty array.

All timestamp values are in milliseconds since the UNIX epoch.