How Do You Get TPEG Data?
This section describes how to obtain TPEG data, including the process flow. TPEG data is obtained through HTTP POST requests. POST requests are made from the vehicle either to a customer back-end server, which authenticates a vehicle and creates a session, or directly to the INRIX TPEG Connect Server in order to obtain traffic data. The customer back-end server is typically operated by the vehicle manufacturer. The POST body contains information in XML.
Annex A and Annex B
The TPEG standard contains two ways to communicate TPEG data to vehicles, called Annex A and Annex B. INRIX makes Annex B generally available for easy integration with the INRIX TPEG Service, whereas Annex A is only implemented under special circumstances. The information on this page is relevant to Annex B. You can learn more about Annex A on the Annex A page.
How TPEG data is returned and what data is included is set by several configuration parameters. Examples for configuration data include data format, data type, session expiration time, country map data version, and the radii of the traffic data circles. Configuration files fall into two categories:
- Configuration values that are set by INRIX, but can be customized for a particular application.
- Configuration values that are set when initializing a new session. If a configuration value is not set when initializing a new session, then the default value set by INRIX is used.
The following diagram shows the data flow for the TPEG Annex B specification, which involves initializing a session, and getting messages. The request to get messages is called multiple times, until the session expires. Note: Before the first step, where a session is initialized, you must first have an authentication step between the client and the customer back-end server. It is the responsibility of this authentication step to insure that the client has a valid subscription to the TPEG data.
Initializing a Session
In order to obtain TPEG data, the client must start a session. Session initialization is accomplished with the session HTTP POST request. In the TPEG specification, this is referred to as the init_session method. Session initialization follows these steps:
- The client makes a request to the customer back-end server to start a new session. Configuration data is included in this request.
- The back-end server sends the configuration data to the INRIX TPEG Connect Server.
- The TPEG Connect Server responds with a session ID.
- The back-end server passes the session ID to the client.
The session ID is then used in all subsequent calls. The length of time for which the session ID is valid can be configured. It is recommended to be 1 hour, which is the default value.
Get TPEG Data
Once a session is established, the messages HTTP POST request is used to obtain TPEG data. In the TPEG specification, this is referred to as the get_messages method. Transaction IDs are used to keep the client and server in sync for the life of the session. The process flow is as follows:
- The client requests TPEG information using the session ID and a transaction ID (TID) value of 0.
- The TPEG server returns data to the client with complete information and a new TID value (typically increased to 1).
- Later, the client requests TPEG information using the session ID and the new TID value.
- The TPEG server returns data to the client, containing only what has changed since TID had a value of 0.
- Future requests continue in this fashion with a new TID being returned each time by the messages method, which then must be used in the next request by the client device. Each time, only data is returned that has changed since the previous TID value.
- The session expires at the specified time, and the server sends a message indicating that a new session must be initialized.
The messages request may return an error under any of the following circumstances. If this occurs, you need to initialize a new session.
- If the server receives a request where the TID is either ahead or behind of what it expects, suggesting that the client and server are out of sync.
- If the time since the initialization of the session exceeds the session length configuration parameter. It is recommended that you keep track of time and initialize a new session before this occurs.
- If the time between messages calls exceeds the timeout configuration parameter. It is recommended that you keep track of time and initialize a new session if this occurs.
Typically, the message data is encrypted. When encryption is used, the session call is over a secure channel, which then returns the encryption key. When the message call is made, data is not being sent over a secure channel, so the key is used to encrypt and decrypt the data.
Previous: Why Use TPEG?
Next: For What Locations Does INRIX TPEG Return Data?