apeman-service-eventsource
Apeman service for SSE event source
Last updated 8 months ago by okunishinishi .
MIT · Repository · Bugs · Original npm · Tarball
$ cnpm install apeman-service-eventsource 
SYNC missed versions from official npm registry.

apeman-service-eventsource

Build Status npm Version JS Standard

Apeman service for SSE event source

Installation

$ npm install apeman-service-eventsource --save

Usage

#!/usr/bin/env node

'use strict'

const { ApEventsourceService } = require('apeman-service-eventsource')
const { createStore } = require('redux')
const { reducer } = require('apeman-service-base')
const co = require('co')

co(function * () {
  let store = createStore(reducer)
  let { observe } = new ApEventsourceService(store)

  let server = observe('/sse/system', {}, {
    'server:restart': (e) => { /* ... */ }
  })

  /* ... */

  server.close()

}).catch((err) => console.error(err))

API

apeman-service-eventsource@1.0.2

Apeman service for SSE event source

Functions

create(args) -> ApEventsourceService

Create the service instance

Param Type Description
args *

ApEventsourceService Class

Service

new ApEventsourceService(store, options)

Constructor of ApEventsourceService class

Param Type Description
store Object Redux store
options Object Optional settings

service.observe(url, params, handlers) -> EventSource

Observe event source

Param Type Description
url string
params Object
handlers Object Event handlers

License

This software is released under the MIT License.

Links

Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (6)
Dev Dependencies (14)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |