Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grexxconnect-ess

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grexxconnect-ess

Grexx Connect - External System Service Helper

  • 1.3.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
51
increased by5000%
Maintainers
0
Weekly downloads
 
Created
Source

GrexxConnect External System Service (ESS) Helper

Install

npm install grexxconnect-ess --save

Features

  • reject messages (since v1.0.9)
  • auto-reconnect (since v1.0.5)
  • custom monitoring data (since v1.0.5)
  • basic receiving and responding to ESS messages

Simple Example

"use strict";
const EssConnect = require('grexxconnect-ess');

const GrexxConnectEss = new EssConnect({
    applicationName: "My Custom ESS v2.4",
    username:        "John",
    password:        "JohnsPassword",
    server:          "wss://server.com"
});

GrexxConnectEss.on('message', Message => {
    console.info('Received a message', Message.parsed, Message.content);
    const reversedValue = (Message.parsed.content || '').split("").reverse().join("");
    Message.resolve([{
        reference: 'outputField',
        values:    [{ value: reversedValue }]
    }])
});

Full Example

"use strict";
const EssConnect = require('grexxconnect-ess');

const GrexxConnectEss = new EssConnect({
    applicationName: "My Custom ESS v2.4",
    username:        "John",
    password:        "JohnsPassword",
    server:          "wss://server.com",
    debug:           true
});

GrexxConnectEss.on('message', Message => {
    console.info('Received a message', Message.parsed, Message.content);
    const reversedValue = (Message.parsed.content || '').split("").reverse().join("");
    
    if( reversedValue === 'error' ) {
        Message.reject('Error message for production', 'Error message for debugging', {
            additionalErrorContext:"Include additional error info here"
        });
    } else {
        Message.resolve([{
            reference: 'outputField',
            values:    [{ value: reversedValue }]
        }]);
    }
});

GrexxConnectEss.setMonitoringResponse(() => {
    return {
        //== required. can be 'ok', 'warning', 'error'
        status:          'ok',
        //== Optional extra status data. Can be whatever you want.
        messagesInQueue: 0,
        lastMessage:     '10 days ago'
    };
});

GrexxConnectEss.on('authorized', serviceName => console.info('Authorized!', serviceName));
GrexxConnectEss.on('disconnected', () => console.info('Disconnected!'));
GrexxConnectEss.on('error', error => console.error('Error: ', error));

FAQs

Package last updated on 19 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc