5.0.5 • Published 2 years ago

eventsquare-gate v5.0.5

Weekly downloads
104
License
-
Repository
github
Last release
2 years ago

EventSquare Gate

Server and client for real-time communication at events between devices.

Installation

npm i eventsquare-gate

Example server

//Configuration

require('dotenv').config()
const path = require('path');
const EventSquare = require('eventsquare-gate');

const config = {
    api_endpoint: process.env.API_ENDPOINT,
    //scantoken: process.env.SCANTOKEN,
    name: process.env.DEVICE_NAME,
    port: process.env.PORT,
    bonjour: true,
    storage_path: path.join(__dirname + '/storage'),
    timezone: process.env.TIMEZONE,
    eventName: process.env.EVENT_NAME,
    eventDate: process.env.EVENT_DATE,
    eventLocation: process.env.EVENT_LOCATION,
    footerline: process.env.TICKET_FOOTER
};

//Start Gate Server
const gate = new EventSquare.Gate(config);

gate.start();

gate.on('print_order', (event, device) => {
    gate.socket.printer.printOrder(event, process.env.PRINTER_IP, 9100);
});

//Listen for incoming EID reads
gate.on('eid_read',event => {
    //event object contains source, event and data.
});

Creating a client

Node.js

Use the static discover() method to find running EventSquare gates on the network. The example connects with the first one found.

const EventSquare = require('eventsquare-gate');

let client;

EventSquare.discover(2500,(gates) => {

	//Connect with first gate found with Bonjour
    client = new EventSquare.Client({
        name: 'EID1',
        host: gates[0].host,
        port: gates[0].port
    });
    
    //Simulate EID reads at interval
    setInterval(() => {
        client.emit('eid_read',{
            firstname: 'John',
            lastname: 'Doe'
        });
    },2500);
});
5.0.5

2 years ago

5.0.4

2 years ago

5.0.3

2 years ago

5.0.2

2 years ago

5.0.1

2 years ago

5.0.0

2 years ago

4.0.1

4 years ago

4.0.0

4 years ago

3.0.9

5 years ago

3.0.8

5 years ago

3.0.7

5 years ago

3.0.6

6 years ago

3.0.5

6 years ago

3.0.4

6 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.11

7 years ago

0.1.10

7 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.1

7 years ago