@statflo/socket
TypeScript icon, indicating that this package has built-in type declarations

3.1.2 • Public • Published

@statflo/socket

A promised StompJS and SockJS class for managing subscriptions easily.

Usage

import SocketService from '@statflo/socket';

const service = new SocketService('http://foo.bar/live', { connectHeader: 'foobar' }); // where { connectHeader } is an instance of Stomp.StompHeaders

service.connect()
    .then(frame => {
        console.log(frame);
    })
    .catch(error => {
        console.error(error);
    });

Subscription

const exchange = service.subscribe('foo/bar', function(message) {
    console.log(message);
});
exchange.unsubscribe('foo/bar');

Messaging

service.message('foo/bar', 'Hello world!');

License

MIT Statflo Inc.

Readme

Keywords

none

Package Sidebar

Install

npm i @statflo/socket

Weekly Downloads

5

Version

3.1.2

License

MIT

Unpacked Size

638 kB

Total Files

3

Last publish

Collaborators

  • emgem
  • jcroll.statflo.com
  • productlabs
  • dmstatflo
  • statflo-dev
  • statfloian