Coder Social home page Coder Social logo

industrial-edge / pingpong-nodejs Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 646 KB

Javascript implementation of the Databus Ping Pong example

License: MIT License

JavaScript 100.00%
nodejs industrial-edge ie-databus ie-flow-creator v1-2 configuration-service

pingpong-nodejs's Introduction

Databus Ping Pong Node.js

This application example contains the source files to build a Databus Ping Pong application implemented in Node.js.

Description

Overview

This application example shows how to connect to the Databus via MQTT and how to publish and subscribe data using an implementation in Node.js. The Flow Creator is used to exchange data between different topics within the Databus.

Use Case

This implementation example uses the node:14.17.1-alpine image as the base layer and runs the provided script after installing all necessary dependencies.

This example also shows two ways of configuring the application:

  • configuration via file upload (fixed configuration file)
  • configuration via system app Configuration Service (custom configuration UI with JSON Forms)

General task

The application includes a MQTT client to subscribe to one topic of the Databus and waits to receive data. When data arrives, it publishes a corresponding answer to a second topic of the Databus. If it receives the string "Ping", it will answer with "Pong" and the other way around.

Use Case

The names of the Databus topics as well as the credentials used by the application can be configured via different options, otherwise environmental variables included in the docker-compose file are used.

Requirements

Used components

  • Industrial Edge Management (IEM) V1.5.2-4 / V1.11.8
    • Databus Configurator V2.0.0-5
    • Databus V2.0.0-4
    • Flow Creator V 1.12.0-1
    • IE App Configuration Service V1.2.2
  • Industrial Edge Device (IED) V1.10.0-9
  • Industrial Edge App Publisher V1.10.5
  • Docker Engine V20.10.3
  • Docker Compose V2.4

Further requirements

  • IED is onboarded to a IEM
  • Databus Configurator is deployed to the IEM
  • IE Configuration Service is deployed to the IEM
  • Databus is deployed to the IED
  • Flow Creator is deployed to the IED

Installation

Please refer to the Installation section of the Ping Pong in C# repository on how to build and deploy the application to an IED. Just use the source files from this repository and follow the instructions.

Usage

Once the application is successfully deployed to the IED, it can be tested using the Flow Creator.

On the IED restart the PingPong application, to ensure the right configuration is used. Then open the app Flow Creator and set it up as following:

  • Connect an "inject" node with a "mqtt out" node
  • Connect a "mqtt in" node with a "debug" node
  • Configure the mqtt-nodes to connect to the databus (mqtt broker, username, password)
  • Set the topics of the mqtt-nodes according to the configuration of the application (here: "topic1" to publish to, "topic2" to subscribe to)

Deploy the flow and test by injecting a string payload into the mqtt in node. If the string is "Ping", the application will answer with "Pong". If the string is "Pong" the application will answer with "Ping".

The finished flow is available here and can be imported into the Flow Creator.

Flow Creator

Documentation

Contribution

Thank you for your interest in contributing. Anybody is free to report bugs, unclear documentation, and other problems regarding this repository in the Issues section. Additionally everybody is free to propose any changes to this repository using Pull Requests.

If you haven't previously signed the Siemens Contributor License Agreement (CLA), the system will automatically prompt you to do so when you submit your Pull Request. This can be conveniently done through the CLA Assistant's online platform. Once the CLA is signed, your Pull Request will automatically be cleared and made ready for merging if all other test stages succeed.

License and Legal Information

Please read the Legal information.

Disclaimer

IMPORTANT - PLEASE READ CAREFULLY:

This documentation describes how you can download and set up containers which consist of or contain third-party software. By following this documentation you agree that using such third-party software is done at your own discretion and risk. No advice or information, whether oral or written, obtained by you from us or from this documentation shall create any warranty for the third-party software. Additionally, by following these descriptions or using the contents of this documentation, you agree that you are responsible for complying with all third party licenses applicable to such third-party software. All product names, logos, and brands are property of their respective owners. All third-party company, product and service names used in this documentation are for identification purposes only. Use of these names, logos, and brands does not imply endorsement.

pingpong-nodejs's People

Contributors

ariefkasim avatar boehmi-tb avatar evakaul avatar filipd147 avatar molanger avatar stancd-siemens avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

yiranvvvv

pingpong-nodejs's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.