Skip to content

How to make promise from web-socket API? #21

@allawitte

Description

@allawitte

Thank you for your video!
I do application on nodejs what request some data on external server and relay them to some external client via TCP.
Do you have an idea how to make promise from the code like:

const Market = require('some-api');
myMarket = new Market();
myMarket.websockets.trades(request[1], (trades, error) => {
  if (error) {
    send to external client(error);
  }
  if(this.streamStatuse === 1) {
    send to external client(JSON.stringify(['TR', this.getTimeString(), trades]));
  }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions