An implementation of the FLL Score Client Protocol.
npm install fllscoreclient

An implementation of the FLL Score Client Protocol in Javascript.
> This module is intended to be used with the FLL Scoring Software Only!
> Using this with another system is not supported
bash
$ npm install fllscoreclient
`Overview
The FLL Scoring Software includes a public API for clients to connect and receive
scoring info. The software communicates with clients through a TCP socket connection.
This package provides the following objects to connect:
1) A local client that can perform all actions of the protocol (requires node.js to run).
2) A Web client on the browser that can receive scoring info as new data is available.*
>*The Web client requires a proxy server to run as raw tcp sockets are not available
> on the browser.
See the API section below for more info on each object
Running In the Browser
(Requires a WebProxy to be running as well, see instructions below)
`html
Title
Check the console...
`Running The Web Proxy
`js
var fllScoreProxy = require('fllscoreclient/dist/fllscoreclientproxy');var proxy = fllScoreProxy.createWebProxy({
servePort: 8101,
infoPollingRate: 3,
socketOpts: {
host: 'localhost',
port: 8100
}
});
proxy.startProxy().then((res) => {
if (res) {
console.log('Server Started...');
} else {
console.log('Server Unable to Start... try again');
}
});
`Running Locally
`js
var fllScoreProxy = require('fllscoreclient/dist/fllscoreclientproxy');var client = fllScoreProxy.createClient({host: 'localhost', port: 8100});
client.connect().then(function(res) {
console.log(res);
return client.sendPing();
}).then(function(res) {
console.log(res);
return client.sendLastUpdate();
}).then(function(res) {
if (res) {
console.log('Update is necessary');
} else {
console.log('No Update Needed');
}
console.log(client.lastUpdate.toISOString());
return new Promise(function (resolve) {
setTimeout(resolve, 5000);
});
}).then(function() {
return client.sendScore();
}).then(function(res) {
console.log(JSON.stringify(res));
return client.sendLastUpdate();
}).then(function(res) {
if (res) {
console.log('Update is necessary');
} else {
console.log('No Update Needed');
}
console.log(client.lastUpdate.toISOString());
return client.close();
}).then(function(res) {
console.log(res);
}).catch(function(err) {
console.log('Rejected: ' + err.message);
});
`Examples
Examples can be run after checkout by running npm install and starting the mock server
`bash
$ cd example/$3
$ python server.py$3
$ node test.js$3
$ node webProxy.js
``Incoming...
The full documentation is available in the docs folder here