Giter Club home page Giter Club logo

talk-node-sdk's Introduction

Talk-Node-Sdk

NPM version Build Status Talk topic

Usage

talk = require 'talk-node-sdk'

config =
  appToken: 'yyyyyy-ffff-gggg-hhhh-aaaaaaaaaaa'
  apiHost: 'http://localhost:7001'

talk.init(config)

# Initialize a webhook reciever service
app = require('express')()
service = talk.service app, prefix: '/'

# Initialize a worker
worker = talk.worker
  interval: 100
  runner: (task) ->  # Call the runner when the task executed

# OR
# Use the cron pattern to define the interval of ticks
worker = talk.worker
  cron: '* * * * * *'
  runner: (task)->

## An 'execute' event will be emitted when a task executed
worker.on 'execute', (task) ->

## Bind the worker to the service
worker.watch service

# Initialize another client
client = talk.client(token)

TODO

  • Use cron to execute worker

Events

  • * listen to all event
  • message.create message create event

Apis

ChangeLog

0.4.7

  • Use the cron pattern to define interval of ticks

0.4.1

  • execute jobs parallelly, set the default concurrency to 5

0.4.0

  • add worker in sdk
  • use promise
  • remove express dependency

0.3.0

  • move event emitter to service
  • reconnect the api server when the discover api failed

0.2.0

  • bump to new version

0.1.1

  • Use methods from discover api
  • Add support for 'GET', 'PUT', 'POST', 'DELETE' methods
  • Replace url params with the correct value

talk-node-sdk's People

Contributors

sailxjx avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.