npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@embr-modules/event-stream

v0.4.3

Published

An Ignition module that provides an API for high-speed streaming of tag changes and alarm events via SSE (server-sent events).

Downloads

74

Readme

Embr Event Stream Module

An Ignition module that provides an API for high-speed streaming of tag changes and alarm events via SSE (server-sent events).

Server-Sent Events (SSE) is a server push technology enabling a client to receive automatic updates from a server via an HTTP connection. All modern browsers support server-sent events: Firefox 6+, Google Chrome 6+, Opera 11.5+, Safari 5+, Microsoft Edge 79+.

Getting Started

  1. Download the latest version from releases.
  2. Install the module through the Ignition Gateway web interface.

Module Documentation

Gateway API


Create a EventStream Session

Creates a EventStream session containing the specified tags. The returned session_id is used to access the stream.

As a security measure, the session_id is time-limited and single use. If the session is not accessed within 30 seconds after creation, a time-out occurs and the session is discarded. Only a single client may access a given session_id.

| Item | Value | |--------|----------------------------| | URL | /embr/tag/stream/session | | Method | POST | | Body | { tagPaths: [] } | | Auth | body |

Body Example

{
  "username": "admin",
  "password": "password",
  "tag_paths": [
    "[default]Tag1",
    "[default]Path/Tag2"
  ]
}

Success Response

Code : 200 OK

The response is a JSON object containing the session_id of the stream and details of the tags included in the session.

Each tag is given a numeric tag_id in order to compress the event source message size. The EventSource messages will use this tag_id when sending tag change information.

{
  "status": "success",
  "data": {
    "session_id": "8c1a5b02-df33-4a2e-ad6f-101f76ab3d06",
    "tags": [
      {
        "tag_path": "[default]Tag1",
        "alarm_path": "prov:default:/tag:Tag1",
        "tag_id": 0
      },
      {
        "tag_path": "[default]Path/Tag2",
        "alarm_path": "prov:default:/tag:Path/Tag2",
        "tag_id": 1
      }
    ]
  }
}

Subscribe to a EventStream Session

Subscribe to a EventStream by its session_id. This endpoint is meant to be accessed by an EventSource. For more details, see Mozilla's MDN WebDocs.

| Item | Value | |--------|-----------------------------------------| | URL | /embr/tag/stream/session/{session_id} | | Method | GET | | Params | session_id: EventStream session id | | Auth | None |

Success Response

Code : 200 OK

Messages events have the following format:

event: tag_change
data: {"tag_id":0,"v":"Tag Value!","q": 192,"t":1717624491517}

event: alarm_event
data: {"tag_id":0,"count":1,"displayPath":"","eventData":{"eventValue":"false","name":"AlarmName","eventTime":"Thu Jun 20 13:17:37 EDT 2024","priority":"Critical","displayPath":""},"extension":{"isShelved":"false"},"id":"454d77c5-44f8-4e52-ab3c-e1ed5c950583","isAcked":false,"isCleared":false,"isShelved":false,"label":"AlarmName","name":"AlarmName","notes":"","priority":"Critical","source":"prov:default:/tag:Tag1:/alm:AlarmName","state":"Active, Unacknowledged","values":[{"isShelved":"false"}]}

Changelog

The changelog is regularly updated to reflect what's changed in each new release.

Copyright and Licensing

Copyright (C) 2023 Musson Industrial

Free use of this software is granted under the terms of the MIT License.