Skip to content

Parobus/mortgage-broker-tools.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MBT - GraphQL Subscription via WebSocket Connection for Node.js

This repo showcases caseResults GraphQL subscription via WebSocket connection to MBT WebSocket API.

Description

The MBT WebSocket API is powered by Phoenix Sockets and Absinthe. Therefore, to integrate seamlessly the API was consumed via Phoenix Sockets client for Node.js phoenix-channels and Absinthe client @absinthe/socket.

Installation

After cloning the repository run the command:

yarn add
// or
npm install

Usage

As it can be seen in the given examples folder:

  • Import MortgageBrokerToolsAPI
const MortgageBrokerToolsAPI = require("../index.js");
  • Pass the Token and init MortgageBrokerToolsAPI
const api = new MortgageBrokerToolsAPI("YOUR_TOKEN");
  • Init the connection and subscribe to caseResults by passing the case uuid
api.connect();

api.listenToCaseResults(
  "YOUR_CASE_UUID",
  (result) => console.log(result),
  (err) => console.error(err)
);

Notes

MBT WebSocket API endpoint, API version and GraphQL query are hard-coded in the root index.js file. For any desired implementation, these hard-coded values and the usage of the phoenix-channels and @absinthe/socket can be changed or used by being inspired from this repo.

For more extensive usage, please refer to phoenix-channels and @absinthe/socket documentations.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published