Socket
Book a DemoInstallSign in
Socket

@paraswap/subscription-service-client

Package Overview
Dependencies
Maintainers
8
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paraswap/subscription-service-client

> Simple client for [Http-Subscription-Service](https://github.com/paraswap/http-subscription-service)

1.0.3
latest
Source
npmnpm
Version published
Weekly downloads
39
-50%
Maintainers
8
Weekly downloads
 
Created
Source

Subscription-service-client

Simple client for Http-Subscription-Service

Table of Contents

  • Install
  • Usage

Install

Install the package from NPM:

npm install @paraswap/subscription-service-client

Usage

import { HttpSubscriptionService } from '@paraswap/subscription-service-client;

// Create na instance
const client = new HttpSubscriptionService(HTTP_SUBSCRIPTION_SERVICE_WS_URL)

// Subscribe for connection event (this event will be triggered as soon as we get a connection to the `http-subscription-service`)
client.on('opened', () => {
      // Create a subscription
      HttpSubscriptionService.subscribe(
        {
          pollInterval: 5000, // Provide a polling interval for your subscription
          requestOptions: { // Request options (AxiosRequestOptions)
            url: `test.com/getWeather`
          },
        },
        (state: { data: WeatherResponse }) => { // Callback for data
          console.log(`Current temp: ${weather.temp}`);
        },
      );
});

FAQs

Package last updated on 05 Jul 2022

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.