sock-client-stompdeprecated

Project based high level abstraction of SSP

Usage no npm install needed!

<script type="module">
  import sockClientStomp from 'https://cdn.skypack.dev/sock-client-stomp';
</script>

README

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