Skip to content

terryjohndado/WebSocketTest

Repository files navigation

WebSocketTest

Connects to a Suprema BioStar 2 server via WebSocket to stream real-time event logs with optional filtering.

🚀 Features

  • Connects to BioStar 2 WebSocket endpoint to get BioStar2 device's endpoints in real-time.
  • Parses incoming Event JSON payloads for event log data.
  • Supports client-side filters:
    • Device ID filter – only return events from specified devices.
    • Event ID filter – only return events of specific types.

🔧 Setup & Usage

  1. Clone this repo and install dependencies:

    git clone https://github.com/terryjohndado/WebSocketTest.git
    cd WebSocketTest
    npm install
  2. Update the WebSocket endpoint URL and BioStar2 API endpoint URL.

image
  1. Update BioStar2 login credentials.
image
  1. Configure filters Here, you can use bsEvent.Event.DeviceId.Id to filter the events by Device ID or bsEvent.Event.EventTypeId.Code to filter the events by Event Code.

※ Explore Event class to check for other filters. image

  1. Run it:

    node index.js
  2. The app will:

    • Connect over WSS to BioStar 2.
    • Authenticate as needed.
    • Listen for and parse incoming event logs
    • Filter based on deviceFilter and/or eventFilter.
    • Emit or log only the matching events.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages