WebSocket API

Introduction

Our WebSocket API uses socket.io. You must use a socket.io client to interact with the Redshift WebSocket API.

If you are building a JavaScript or TypeScript application, we have a JavaScript client package that does a lot of the heavy lifting for WebSockets.

Client Example

import { WebSocketClient } from "@radar/redshift-api-client";

const client = new WebSocketClient();

await client.connect();

const quoteRequest = {
    market: "BTC_LBTC",
    invoice: "lnbc1m1p0zwsllpp5np23cxgafxcqnk434v86rlnpght09gvnzwtrvy0y704nqtjtffvqdqdgdf4wgztv4uhxcqzpg3awyquek08frfexrphkm9sjwdggkfepm6uxex0lg4m8s0s59d7z8kdf9cajvc00cwl2nzu57qe9n92fv2mzm4hlgctw2x3v0lxcjrrcpul9wen",
    refundAddress: "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
};

const quote = await client.requestQuote(quoteRequest);

console.log(quote);

// {
//   orderId: "13283979-2c0b-45e4-b2e0-2a487535822e";
//   expiryTimestampMs: 1578598212267;
//   amount: "0.001056000000000000";
//   details: {
//     payToAddress: "3LKomc2i3rLm2TnA36U4pGH25cFWvRMnJB";
//     redeemScript: "76a914d5846ccb08521347c1d5718ec460656d67427cbf8763752102369b4d174f601239daef6a83bf553092e139901e6ed19ffbcbedcee07be7a4ae6703575709b17576a914c1e27ac884310271f04dd1ebe9eb4e135113a1d08868ac";
//     refundableAtBlockHeight: 612183;
//   }
// }

JavaScript Example

Other Language Clients:

Last updated

Was this helpful?