Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Publisher Plugin: Send data to external server #71

jfgilliam opened this issue Sep 19, 2016 · 0 comments


Copy link

commented Sep 19, 2016

I have received several requests from league owners to be able to monitor more things than iRacing provides in their telemetry about all the drivers. To accomplish this, this plugin will be designed to send that data to an external web server. For it to work properly, each driver would need to be running SRA with the web server address configured. The web server would need to write the data to a database and then provide several views to that data to accomplish what you want.

Note: It's important to not publish any data that the SIM Vendor would consider cheating, or that a driver would not want shared.

Each user would have to enter the web server address into their settings file for this plugin to start publishing. Each entry will have to have the League ID appended. The League ID can be found by looking at the URL on the Leagues Page to "View" the league in iRacing. PRL's league id for the AdvoCare league is 1643. (NOTE: Using a league id of zero(0) will publish all other iRacing Sessions). Unless a URL is defined for a league, it will not publish anything.

1. DataPublisher-Post = true
2. DataPublisher-Post-URL-1643 =
3. DataPublisher-Post-Interval-1643 = 5000
4. DataPublisher-Post-Log = false

The plugin will start sending data, for the defined interval in milliseconds, using a HTTP POST with the data as a JSON formatted payload. The web server would have to be able to parse this and store it in a database. Here's a PHP example.

$json = file_get_contents('php://input');
$obj = json_decode($json);

The web server doesn't have to use all the fields, but should also expect new fields to be added at any time. Also, each publisher may not be on the same SRA version, thus each driver may be publishing different fields. Also, timing of each driver could be different, such that, 2 drivers could be the leader in position 1, but that should work itself out within a few seconds.

Example JSON Payload (TODO - Completely documented in final version. Each of these corresponds to the API call to get them

    "Version": "1.1 Build: 2016.09.15",
    "SIMName": "iRacing",
    "SIMVersion": "iRacing Plugin Version: 1.1 Build: 2016.09.15",
    "Session/DiffCars/ME/LEADER": -3.211,
    "Session/Id": "116/1075/45011263/10718048",
    "Session/IsCautionFlag": false,
    "Session/LeagueId": 1643,
    "Session/Type", "RACE",
    "Session/Lap": 2,
    "Session/Laps": 200,
    "Session/LapsToGo": 198,
    "Session/StrengthOfField": 2443,
    "Session/Cars": 32,
    "Session/StartDateGMT": "2016-12-25 01:10:00",
    "Session/PostDateGMT": "2016-12-25 01:10:05",
    "Track/Description": "Atlanta Motor Speedway",
    "Car/ME/TeamName": "Trucks",
    "Car/ME/DriverName": "James Krahula",
    "Car/ME/DriverNameShort": "J. Krahula",
    "Car/ME/DriverInitials": "JK",
    "Car/ME/Id": 12345,
    "Car/ME/DriverClubName": "Georgia",
    "Car/ME/Discontinuality": 0,
    "Car/ME/ClassName": "GT3",
    "Car/ME/ClassColor": "14540253",
    "Car/ME/Description": "Chevrolet Silverado",
    "Car/ME/DriverRating": "12345-A3.65",
    "Car/ME/Number": "24",
    "Car/ME/NumberSlant": "forward",
    "Car/ME/Color": "14540253",
    "Car/ME/ColorNumberBackground": "14540253",
    "Car/ME/ColorNumberOutline": "14540253",
    "Car/ME/ColorNumber": "14540253",
    "Car/ME/Lap": 22,
    "Car/ME/Lap/LED": 1,
    "Car/ME/PitTime": 13.3,
    "Car/ME/Gauge/TirePressureLF/Count": 1,
    "Car/ME/Gauge/TirePressureLR/Count": 1,
    "Car/ME/Gauge/TirePressureRF/Count": 2,
    "Car/ME/Gauge/TirePressureRR/Count": 2,
    "Car/ME/Position": 3,
    "Car/ME/PositionQualifying": 2,
    "Car/ME/PositionClass": 1,
    "Car/ME/PositionQualifyingClass": 1,
    "Car/ME/Lap/BEST": 32.123,
    "Car/ME/LapTime/BEST": 3,
    "Car/ME/LapTime/LAST": 33.222,
    "Car/ME/Lap/COMPLETED": 21,
    "Car/ME/Lap/PITTED": 17,
    "Car/ME/LapTimes": [32.123,32.3,32.4,...],
    "Car/ME/PitTimes": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13.3],
    "Car/ME/IsBlackFlag": false,
    "Drivers" : [
            "Number": "24",
            "DriverName": "James Krahula",
            "ClassName": "Trucks"
            "Number": "61",
            "DriverName": "Jeffrey Gilliam",
            "ClassName": "Trucks"

The web server should return the following in the response packet payload. I will see if I can either display these or actually enforce them. The positions are your real-time points positions based on how your league works. I will write new Widget to display these like the Standings App does.

    "MaxTires": 3,
    "DriverInfo" : [
            "Car/ME/Number": "24",
            "Car/ME/TirePressureRF/Count": 0,
            "Car/ME/TirePressureRR/Count": 0,
            "Car/ME/TirePressureLF/Count": 1,
            "Car/ME/TirePressureLR/Count": 1,
            "Car/ME/IsChase": true
            "Car/ME/Number": "61",
            "Car/ME/TireRF/Count": 1,
            "Car/ME/TireRR/Count": 1,
            "Car/ME/TireLF/Count": 1,
            "Car/ME/TireLR/Count": 1,
            "Car/ME/IsChase": false
    "LeaguePositions": [
            "DriverName": "James Krahula",
            "Number": "24",
            "Points": 4022,
            "Change": 3
            "DriverName": "Jeffrey Gilliam",
            "Number": "61",
            "Points": 4023,
            "Change": -1
    "LeaguePositionsClass": [
        "GT3": [
                "DriverName": "Jeffrey Gilliam",
                "Number": "61",
                "Points": 4023,
                "Change": 3

@jfgilliam jfgilliam added this to the Version 1.2 milestone Sep 19, 2016

@jfgilliam jfgilliam self-assigned this Sep 19, 2016

@jfgilliam jfgilliam closed this in 3f07e84 Sep 29, 2016

@jfgilliam jfgilliam reopened this Oct 5, 2016

@jfgilliam jfgilliam closed this Feb 22, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.