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

iqevents-js-sdk

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iqevents-js-sdk

JavaScript SDK used for easily managing listeners for MarkoIQ RTM

  • 1.0.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

IQEvents JS SDK

Node.js Package

This package acts as a wrapper that provides easy access to the MarkoIQ pusher-driven realtime events system.

Installation

You can install this package using Yarn:

yarn --dev markoiq/iqevents-js

Setting Up

IQEvents is a simple library that is meant to work with the MarkoIQ RTM token API. Before you can set up this client on your application you're going to want to issue a scoped RTM token to initialize your client with.

Once you have the RTM token, simply invoke the iqevents function anywhere in your application.

getRtmToken(['myscope']).then((token: string) => iqevents(token));

Getting an RTM Token

You can use the MarkoIQ API to issue a token you can then expose to a user of your application, here is a PHP example:

<?php

$api = new MarkoAPI();

return $api->store($storeId)->getRtmToken(array $scopes);

Subscribing to an event

Once you've initialized the library using the iqevents helper, you can then simply use the library's subscribe method:

subscribe('store-1.broadcasts', payload => {
   console.log('My event!'); 
});

Using promises

This library also provides a set of methods for writing promise-based routines. You would really only use this for expecting single messages on async functions and things of the sort:

import { iqPromise } from "iqevents-js-sdk";

iqPromise.listen('store-1.broadcasts').then(payload => {
    // This will only resolve once, naturally
});

FAQs

Package last updated on 26 Dec 2021

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