kmailapi-sdk
This is an SDK to the Kmail bet API in this API you can connect, subscribe and query the active market, line and prices. this project is a base project for working with Kmail API and will save time connecting and running you first requests to Kmail API
Last updated 5 months ago by liraneli .
ISC · Original npm · Tarball · package.json
$ cnpm install kmailapi-sdk 
SYNC missed versions from official npm registry.

This is an SDK to the Kmail bet API in this API you can connect, subscribe and query the active market, line and prices. this project is a base project for working with Kmail API and will save time connecting and running you first requests to Kmail API

Contents

  • Installation
    How to include kmail-sdk in your project.

  • Setup
    How to initiate kmail-sdk.

  • Usage
    A brief introduction to using the kmail-sdk.

Installation

$> npm install kmail-sdk [--save]

Setup

To initiate the package you'll need to run in init function to compile the .proto files:

  const kmail = require('kmail-sdk');
  kmail.KmailProtoLoader.init().then(() => {
    //your code goes here
  });

Usage

In order use the SDK you need to take the kmailSDK and use it as follows:

const Kmail = require('kmail-sdk');
Kmail.KmailProtoLoader.init().then(() => {  
  const licenseKey = 'zzz';
  const identity = 'xxx';
  const password = 'yyy';
  const kmailIP = 'tcp://1.0.0.127';
  const commandSocketProt = '1';
  const dataSocketProt = '2';
  const company = 'yourIdentity';
  // Creating the sdk object (you don't need more then 1)
  const kmail = new Kmail.KmailSDK(kmailIP, company, commandSocketProt, dataSocketProt, licenseKey, identity, password);

  kmail.emitter.on('statusUpdate', (newStatus) => {
    // Subscribe to all events coming from molly. in order to filter the needed object use the emitter and subscribe to the 
    // needed events
    kmail.subscribeToAll();
  });

  kmail.emitter.on('event', (event) => {
    console.log(`received an event object - "${event}"`);
  });

  kmail.connect(); 
});

Current Tags

  • 1.2.1                                ...           latest (5 months ago)

1 Versions

  • 1.2.1                                ...           5 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (18)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |