@finos/fdc3-backplane-client
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-develop.1 • Public • Published

Backplane Client JS

Javascript client which allows web based desktop agents to connect and communicate with backplane through API.

Supported Operations

  • Broadcast context

Usage example

import { BackplaneClient } from '@finos/fdc3-backplane-client';

const instrument = {
  type: "fdc3.instrument",
  id: {
    ticker: "AAPL",
    ISIN: "US0378331005",
    FIGI: "BBG000B9XRY4",
  },
};

var backplaneClient = new backplaneClient.BackplaneClient({
	appIdentifier: {
		appId: 'backplaneJSClient',
	},
	url: 'http://localhost:4475',
});

await backplaneClient.connect(
	//hook for receive message from backplane
	msg => {
		if (msg.type == Fdc3Action.Broadcast) {
			console.info(`Backplane Client: Recived broadcast over channel: ${msg.payload.channelId}`);
		}
		console.info(JSON.stringify(msg));
	},
	//hook on disconnection
	err => {
		console.error(`Backplane Client: Disconnected.${err}`);
	}
);
await backplaneClient.broadcast(instrument, "Channel 1");

Installation

To access the APIs in your application, simply install '@finos/fdc3-backplane-client' npm package:

# npm
npm install @finos/fdc3-backplane-client

#yarn
yarn add @finos/fdc3-backplane-client

Use any of below to locally build and reference this package in your web application.

License

Copyright (C) 2022 Backplane open source project

Distributed under the Apache License, Version 2.0.

SPDX-License-Identifier: Apache-2.0

Readme

Keywords

none

Package Sidebar

Install

npm i @finos/fdc3-backplane-client

Weekly Downloads

3

Version

1.0.0-develop.1

License

Apache-2.0

Unpacked Size

98.3 kB

Total Files

19

Last publish

Collaborators

  • finos-admin
  • maoo
  • texodus
  • neil.slinger