{"size": 382, "ext": "js", "max_stars_repo_path": "src/Socket.js", "max_stars_repo_name": "MissMonacoin/bitbox-javascript-sdk", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Socket.js", "max_issues_repo_name": "MissMonacoin/bitbox-javascript-sdk", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Socket.js", "max_forks_repo_name": "MissMonacoin/bitbox-javascript-sdk", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 17.3636363636, "max_line_length": 54, "alphanum_fraction": 0.5785340314}
import io from 'socket.io-client';

class Socket {
  constructor(restURL = 'https://rest.bitbox.earth') {
    this.socket = io(`${restURL}`);
  }

  listen(endpoint, cb) {
    this.socket.emit(endpoint);

    this.socket.on('blocks', (msg) => {
      return cb(msg);
    });

    this.socket.on('transactions', (msg) => {
      return cb(msg);
    });
  }
}

export default Socket;
