5.0.5 • Published 8 months ago
eventsquare-gate v5.0.5
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
8 months ago
5.0.4
8 months ago
5.0.3
8 months ago
5.0.2
8 months ago
5.0.1
8 months ago
5.0.0
8 months ago
4.0.1
3 years ago
4.0.0
3 years ago
3.0.9
4 years ago
3.0.8
4 years ago
3.0.7
4 years ago
3.0.6
4 years ago
3.0.5
4 years ago
3.0.4
5 years ago
3.0.3
5 years ago
3.0.2
5 years ago
3.0.1
5 years ago
3.0.0
5 years ago
0.2.4
5 years ago
0.2.3
5 years ago
0.2.2
6 years ago
0.2.1
6 years ago
0.2.0
6 years ago
0.1.11
6 years ago
0.1.10
6 years ago
0.1.9
6 years ago
0.1.8
6 years ago
0.1.7
6 years ago
0.1.6
6 years ago
0.1.5
6 years ago
0.1.4
6 years ago
0.1.3
6 years ago
0.1.2
6 years ago
0.1.1
6 years ago
0.1.0
6 years ago
0.0.9
6 years ago
0.0.8
6 years ago
0.0.7
6 years ago
0.0.6
6 years ago
0.0.5
6 years ago
0.0.4
6 years ago
0.0.3
6 years ago
0.0.1
6 years ago