(Event message format)
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
WebSocket support is enabling other applications to listen passing data in real time.
+
WebSocket support enables other applications to control ChronoFly and obtain real time passing data.
 +
 
 +
<u>Do not expose your timing network for unauthorized access!</u> There is no authentication mechanism in this WebSocket implementation.
 +
 
 +
==Usage example==
 +
'''JavaScript:'''
 +
 
 +
var j2ws = new WebSocket("ws://localhost:2235");
 +
 +
j2ws.onmessage = function(e) {
 +
  var event = e.data.split(": ")[0];
 +
  var value = e.data.split(": ")[1];
 +
 +
  switch(event) {
 +
    case "pas":
 +
      console.log("Passing with transponder: " + value);
 +
      break;
 +
    case "ion":
 +
      console.log("Digital input " + value + " ON");
 +
      break;
 +
  }
 +
}
 +
 +
var startTiming = function() {
 +
  j2ws.send("tim: 1");
 +
}
  
 
==Protocol==
 
==Protocol==
Line 10: Line 35:
  
 
====Supported actions====
 
====Supported actions====
'''Digital I/O port ON'''
+
'''Digital output ON'''
  ion: 4
+
  oon: 4
Where 4 is DIO port.
+
Where 4 is pin number.
  
'''Digital I/O port OFF'''
+
'''Digital output OFF'''
  iof: 4
+
  oof: 4
Where 4 is DIO port.
+
Where 4 is pin number.
  
'''Start/stop timing'''
+
'''Timing START'''
 
  tim: 1
 
  tim: 1
 +
 +
'''Timing STOP'''
 
  tim: 0
 
  tim: 0
Where 1 (on) or 0 (off) is timing state.
 
  
 
===Event message format===
 
===Event message format===
 
  event: value
 
  event: value
  
Where '''event''' is one of supported actions and '''value''' is the output of the event.
+
Where '''event''' is one of supported events and '''value''' is the output of the event.
  
====Supported actions====
+
====Supported events====
 
'''Passings'''
 
'''Passings'''
  pas: 14
+
  pas: 16 1 00:00:21.482
Where 14 is the transponder number.
+
Where 16 is passing's transponder number, 1 is lap number, and 00:00:21.482 is passing time (in format HH:MM:SS.NNN)
 +
 
 +
'''Digital input ON'''
 +
ion: 4
 +
Where 4 is pin number.
 +
 
 +
'''Digital input OFF'''
 +
iof: 4
 +
Where 4 is pin number.
 +
 
 +
'''Start light ON'''
 +
son: 1
 +
Where 1 is light number.
 +
 
 +
'''Start light OFF'''
 +
sof: 1
 +
Where 1 is light number.

Latest revision as of 21:36, 16 January 2017

WebSocket support enables other applications to control ChronoFly and obtain real time passing data.

Do not expose your timing network for unauthorized access! There is no authentication mechanism in this WebSocket implementation.

Usage example

JavaScript:

var j2ws = new WebSocket("ws://localhost:2235");

j2ws.onmessage = function(e) {
  var event = e.data.split(": ")[0];
  var value = e.data.split(": ")[1];

  switch(event) {
    case "pas":
      console.log("Passing with transponder: " + value);
      break;
    case "ion":
      console.log("Digital input " + value + " ON");
      break;
  }
}

var startTiming = function() {
  j2ws.send("tim: 1");
}

Protocol

Uses TCP port: 2235

Action message format

action: value

Where action is one of supported actions and value is the input of the action.

Supported actions

Digital output ON

oon: 4

Where 4 is pin number.

Digital output OFF

oof: 4

Where 4 is pin number.

Timing START

tim: 1

Timing STOP

tim: 0

Event message format

event: value

Where event is one of supported events and value is the output of the event.

Supported events

Passings

pas: 16 1 00:00:21.482

Where 16 is passing's transponder number, 1 is lap number, and 00:00:21.482 is passing time (in format HH:MM:SS.NNN)

Digital input ON

ion: 4

Where 4 is pin number.

Digital input OFF

iof: 4

Where 4 is pin number.

Start light ON

son: 1

Where 1 is light number.

Start light OFF

sof: 1

Where 1 is light number.