# scoring-gateway-receiver

> the receiver only

Latest version **0.0.2** (published 2021-07-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install scoring-gateway-receiver
pnpm add scoring-gateway-receiver
yarn add scoring-gateway-receiver
bun add scoring-gateway-receiver
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2021-07-26 |
| First published | 2021-07-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 15.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Clément TOLOIS & Théo KOEL |
| Maintainers | clement.t |

## Links

- npm: https://www.npmjs.com/package/scoring-gateway-receiver
- npm.io page: https://npm.io/package/scoring-gateway-receiver

## Dependencies (3)

- [express](https://npm.io/package/express.md) ^4.17.1
- [socket.io](https://npm.io/package/socket.io.md) ^2.3.0
- [portscanner](https://npm.io/package/portscanner.md) ^2.2.0

## Recent versions

- 0.0.2 (latest) — 2021-07-26
- 0.0.1 — 2021-07-26

## README

# SCORING GATEWAY

## Installation

1) Download the package from NPM
```
npm i @emg-digital/scoring-gateway
```

2) Add the package to your project
```js
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


```js
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


```js
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

```js
let network = {
    method: "Socket",
    socketPort: 8585
};
let provider = "StreamDeck";

Sender.start(network,provider);
```

4) STOP SENDER

```js
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

```js
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

```js
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

```js
let list = Receiver.getMatchList();
```

2) SUBSCRIBE AND LISTEN A MATCH

```js
// Get Match id from a match from the match list
Receiver.subsribeMatch(MatchId);

Receiver.receiverEmitter.on('subscribed-match',data => {
    console.log(data);
});
```

---
_Source: https://npm.io/package/scoring-gateway-receiver · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
