scoring-gateway-receiver
v0.0.2
Published
the receiver only
Downloads
8
Readme
SCORING GATEWAY
Installation
- Download the package from NPM
npm i @emg-digital/scoring-gateway
- Add the package to your project
const { Sender, Receiver } = require('@emg-digital/');
Use
SENDER
The sender is compatible with several data inputs. It can receive data in UDP, COM PORT and socket.io (Streamdeck) Therefore to launch the sender you must provide a certain number of parameters depending on the method you want to use.
- SENDER (UDP)
network OBJECT Mandatory
method STRING Mandatory, address STRING Mandatory, UDPport INT Mandatory
provider STRING Mandatory
receiverOnlineURL STRING Optional
operationName STRING Optional
let network = {
method: "UDP",
address: "127.0.0.1",
UDPport: 1940,
};
let provider = "tangodelta-handball";
Sender.start(network,provider);
- SENDER (COM PORT)
network OBJECT Mandatory
method STRING Mandatory, comName STRING Mandatory
provider STRING Mandatory
receiverOnlineURL STRING Optional
operationName STRING Optional
let network = {
method: "COM",
comName: "COM4"
};
let provider = "Bodet";//Bodet or SwissTiming or Handvision
Sender.start(network,provider);
- SENDER (SOCKET)
network OBJECT Mandatory
method STRING Mandatory, socketPort INT Mandatory
provider STRING Mandatory
receiverOnlineURL STRING Optional
operationName STRING Optional
let network = {
method: "Socket",
socketPort: 8585
};
let provider = "StreamDeck";
Sender.start(network,provider);
- STOP SENDER
Sender.stop();
RECEIVER
The receiver provides an HTTP and WebSocket API with socket.io. The module launches on the port that you specify at startup. However if the port is not available the application will take care of finding a free one before returning it to you.
- START RECEIVER
port INT Mandatory
let port = 8090;
Receiver.start(port).then(res => {
console.log(res)//Log the port on which the application is started. INT
}).catch(error => {
console.log(error)// Log error. STRING
});
- STOP RECEIVER
Receiver.stop().then(res => {
console.log(res)//Log success. STRING
});
INTERNAL RECEIVER API
The receiver can be used as a simple module if it is used locally. Therefore the module provides an internal API which allows you to retrieve the list of matches and listen to a match.
- GET MATCH LIST
let list = Receiver.getMatchList();
- SUBSCRIBE AND LISTEN A MATCH
// Get Match id from a match from the match list
Receiver.subsribeMatch(MatchId);
Receiver.receiverEmitter.on('subscribed-match',data => {
console.log(data);
});