0.0.2 • Published 3 years ago

scoring-gateway-receiver v0.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

SCORING GATEWAY

Installation

1) Download the package from NPM

npm i @emg-digital/scoring-gateway

2) 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.

1) 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);

2) 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);

3) 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);

4) 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.

1) 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
});

1) 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.

1) GET MATCH LIST

let list = Receiver.getMatchList();

2) 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);
});
0.0.2

3 years ago

0.0.1

3 years ago