1.0.2 • Published 5 years ago

sock-client-stomp v1.0.2

Weekly downloads
6
License
MIT
Repository
github
Last release
5 years ago

sock-client-stomp

NPM version

Project based high level abstraction of SSP

Install

yarn

yarn add sock-client-stomp

npm

npm install --save sock-client-stomp

Import

ES2015

import { SockClient } from 'sock-client-stomp'

CommonJS

const { SockClient } = require('sock-client-stomp')

Usage

import { SockClient } from 'sock-client-stomp'

const socket = new SockClient({
  base: 'http://demo.ssp.com/msg-center/websocket',
  token: 'your token for authentication',
  projectId: 'project you are going to watch',
  // set to false to disable reconnect feature
  reconnect: {
    timeout: 30 * 1000
  }
})

// watch every connection state change
socket.onStateChange(state => {
  console.log('state changed to', state)
})

// subscribe broadcast info
socket.subscribeBroadcast('topic your are going to watch', arg => {
  console.log(arg)
})

// connect
socket.connect()

LICENSE

MIT License

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago