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

@dxfeed/dxlink-websocket-client

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dxfeed/dxlink-websocket-client

dxLink WebSocket Client allows to connect the remote dxLink WebSocket endpoint

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
967
increased by33.93%
Maintainers
3
Weekly downloads
 
Created
Source

Client implementation for the dxLink WebSocket transport protocol.

Install

npm install @dxfeed/dxlink-websocket-client

Usage

Import library into your project.

import { DXLinkWebSocketClient } from '@dxfeed/dxlink-websocket-client'

Client

Create instance of the client.

const client = new DXLinkWebSocketClient()

Connect to the server.

client.connect('wss://demo.dxfeed.com/dxlink-ws')

Provide auth token if required by the server.

client.setAuthToken(token)

Channels

Open isolated channel to service within single connection.

const channel = client.openChannel('FEED', {
  contract: 'AUTO',
})

Send message to the channel.

channel.send({
  type: 'FEED_SUBSCRIPTION',
  add: [
    {
      type: 'Quote',
      symbol: 'AAPL',
    },
  ],
})

Add subscription to the channel.

const sub1 = {
  type: 'Quote',
  symbol: 'AAPL',
}

channel.subscription({
  add: [sub1],
})

Remove subscription from the channel.

channel.subscription({
  remove: [sub1],
})

Receive messages from the channel.

channel.addMessageListener((message) => {
  if (message.type === 'FEED_DATA') {
    console.log(message.data)
  }
})

Keywords

FAQs

Package last updated on 17 May 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