# ufr-online-nodejs-websocket-master-mode-server Node.js WebSocket Master mode Server example. ## Install $ npm install --save ws express ## Run Put uFR Online Reader in Master mode and enter Server URL. Run server using: $ npm start Put card on reader and wait for beep and green light. ## uFR Class usage Create uFR class object **const uFR = new uFRClass();** On WebSocket message event call **uFR.setRequest(data);** where **data** is incoming message. Optional get incoming parameters for example card UID **uFR.getCardId** Set response action for example Beep signal **uFR.readerUISignal(uFR.UFR1, 1,1);** Get generated outgoing message using **uFR.getResponse** and send to uFR Online using WebSocket client for example **ws.send(uFR.getResponse);** ## uFR Class public methods **getSerialNumber** - Returns uFR NFC reader serial number **getOnlineSerialNumber** - Returns uFR Online serial number **getCardId** - Returns Card UID **getReader** - Returns 1 if internal reader is used or 2 if external. **readerUISignal(readerNumber, light, beep)** - Set Reader User interface signal **setTemplate(readerNumber, template)** - Set Barrier control template (not used for uFR Online) **lockOpen(readerNumber, lockNumber, duration)** - Open Barrier control lock (not used for uFR Online) **dlioOpen(readerNumber, lockNumber)** - Open DLIO lock (not used for uFR Online) **ledRingRGB(readerNumber, red, green, blue)** - Turn on uFR NFC reader RGB ring, all LEDs same color (if connected) **ledRingArray(readerNumber, array)** - Turn on uFR NFC reader RGB ring, supported up to 24 LEDs (if connected) **onlineRGB(readerNumber, red, green, blue, duration)** - Turn on uFR Online internal RGB LEDs. Both LEDs same color **onlineRGBDual(readerNumber, red, green, blue, red1, green1, blue1, duration)** - Turn on uFR Online internal RGB LEDs. LEDs colors separated **gpioControl(readerNumber, gpio, state)** - Set external uFR Online GPIO state (0 - LOW, 1 - HIGH, 2 - INPUT) **blinkingControl(readerNumber, state)** - Turn off/on uFR NFC reader blinking LEDs **pause(readerNumber, duration)** - Add pause between commands. ## ReaderNumber parameter **uFR.ONLINE** - Send command to uFR Online **uFR.UFR1** - Send command to first connected uFR NFC reader **uFR.UFR2** - Send command to second (external) connected uFR NFC reader **uFR.BARRIER** - Send command to barrier controller (if available) **uFR.BARRIER** - Send command to DLIO controller (if available)