Websocket

BlofinSocket Object

Constructor:

 let myBlofinSocket = new BlofinSocket(options);

Usage:

import { BlofinSocket } from "./dev-package/sockets/blofinsocket.js";

  let onOpen = (options) => {
  	console.log("Hello World");
  }

  const exampleOpts = new BlofinSocket({
    key: "myKey",
    secret: "mySecret",
    passphrase: "myPassphrase",
    isPrivate: "true",
    clientOnOpen: onOpen
  });

  let myBlofinSocket = new BlofinSocket(exampleOpts);

Options:

  • apiKey: String

    • Given on creation of API key. Required

  • secret: String

    • Secret Key. Required if using private channels

  • passphrase: String

    • Passphrased created by user. Required if using private channels

  • isPrivate: Boolean

    • Indicates whether to use private channels. False by default

  • clientOnOpen: Function(options)

    • Function that takes the options given in the constructor as a parameter and should execute on creation of the websocket once finished opening

  • clientOnMessage: Function(options, msg)

    • Function that takes the options given in the constructor and an incoming message as parameters and should execute on reception of said message

  • clientOnError: Function(options, msg)

    • Function that takes the options given in the constructor and an incoming error as parameters and should execute on reception of said error

  • clientOnClose: Function(code, msg, options)

    • Function that takes a closing code, a message, and the options given in the constructor as parameters and should execute on close

Login

Please refer to the official BloFin API Docs for additional info.

https://docs.blofin.com/index.html#login

Function name:

Usage:

Subscribe

Please refer to the official BloFin API Docs for additional info.

https://docs.blofin.com/index.html#subscribe

Function name:

Usage:

Unsubscribe

Please refer to the official BloFin API Docs for additional info.

https://docs.blofin.com/index.html#unsubscribe

Function name:

Usage:

Last updated