Architecture
The overall picture looks like this
Upon connecting to the local iRacing instance the Racelogger registers with the backend with a unique id (this is generated via the current iRacing weekend info from telemetry).
The manager announces the provider changes on the manager.provider topic.
The analysis and archive components listen to this topic and prepare themselves to receive data from the live topics associated with announced key (for example live.state.{key}) to which the Racelogger will post its data.
At the end of recording the Racelogger calls the remove_provider endpoint. The manager in turn announces this event on the topic manager.provider
Endpoints
Prefix |
Description |
User |
Access |
|---|---|---|---|
racelog.public. |
used for public access (mainly frontend) |
anonymous |
call, subscribe |
racelog.dataprovider. |
used by racelogger to publish race data |
datapublisher |
call, publish, subscribe |
racelog.manager. |
used by the backend apps |
backend |
call, register, publish, subscribe |
racelog.admin. |
used by admin CLI |
admin |
call, register, publish, subscribe |
Crossbar
The following snippet can be used as a template for a crossbar server.
1{
2 "version": 2,
3 "controller": {},
4 "workers": [
5 {
6 "type": "router",
7 "realms": [
8 {
9 "name": "racelog",
10 "roles": [
11 {
12 "name": "anonymous",
13 "permissions": [
14 {
15 "uri": "racelog.public",
16 "match": "prefix",
17 "allow": {
18 "call": true,
19 "register": false,
20 "publish": false,
21 "subscribe": true
22 },
23 "disclose": {
24 "caller": false,
25 "publisher": false
26 },
27 "cache": true
28 }
29 ]
30 },
31 {
32 "name": "racedata_provider",
33 "permissions": [
34 {
35 "uri": "racelog.dataprovider",
36 "match": "prefix",
37 "allow": {
38 "call": true,
39 "register": false,
40 "publish": true,
41 "subscribe": true
42 },
43 "disclose": {
44 "caller": false,
45 "publisher": false
46 },
47 "cache": true
48 },
49 {
50 "uri": "racelog.public.live",
51 "match": "prefix",
52 "allow": {
53 "publish": true
54 },
55 "cache": true
56 }
57 ]
58 },
59 {
60 "name": "backend",
61 "permissions": [
62 {
63 "uri": "racelog.",
64 "match": "prefix",
65 "allow": {
66 "call": true,
67 "register": true,
68 "publish": true,
69 "subscribe": true
70 },
71 "disclose": {
72 "caller": false,
73 "publisher": false
74 },
75 "cache": true
76 }
77 ]
78 },
79 {
80 "name": "admin",
81 "permissions": [
82 {
83 "uri": "racelog.",
84 "match": "prefix",
85 "allow": {
86 "call": true,
87 "register": true,
88 "publish": true,
89 "subscribe": true
90 },
91 "disclose": {
92 "caller": false,
93 "publisher": false
94 },
95 "cache": true
96 }
97 ]
98 }
99 ]
100 }
101 ],
102 "transports": [
103 {
104 "type": "web",
105 "endpoint": {
106 "type": "tcp",
107 "port": 8080
108 },
109 "paths": {
110 "info": {
111 "type": "nodeinfo"
112 },
113 "ws": {
114 "type": "websocket",
115 "options": {
116 "auto_ping_interval": 30000,
117 "compression": {
118 "deflate": {
119 "request_no_context_takeover": false,
120 "request_max_window_bits": 11,
121 "no_context_takeover": false,
122 "max_window_bits": 11,
123 "memory_level": 4
124 }
125 }
126 },
127 "auth": {
128 "anonymous": {
129 "type": "static",
130 "role": "anonymous"
131 },
132 "ticket": {
133 "type": "static",
134 "principals": {
135 "dataprovider": {
136 "ticket": "<ENTER_SECRET_HERE>",
137 "role": "racedata_provider"
138 },
139 "backend": {
140 "ticket": "<ENTER_SECRET_HERE>",
141 "role": "backend"
142 },
143 "admin": {
144 "ticket": "<ENTER_SECRET_HERE>",
145 "role": "admin"
146 }
147 }
148 }
149 }
150 }
151 }
152 }
153 ]
154 }
155 ]
156}