Socket
Socket
Sign inDemoInstall

react-stomp

Package Overview
Dependencies
37
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-stomp

React websocket component with STOMP over SockJS


Version published
Weekly downloads
7.3K
increased by1.11%
Maintainers
1
Install size
8.59 MB
Created
Weekly downloads
 

Readme

Source

react-stomp

Build Status Coverage Status License js-standard-style

React component for SockJS-client with STOMP messaging protocol.

Installation

npm install --save react-stomp

Example Usage

import React from 'react';
import SockJsClient from 'react-stomp';

class SampleComponent extends React.Component {
  constructor(props) {
    super(props);
  }

  sendMessage = (msg) => {
    this.clientRef.sendMessage('/topics/all', msg);
  }

  render() {
    return (
      <div>
        <SockJsClient url='http://localhost:8080/ws' topics={['/topics/all']}
            onMessage={(msg) => { console.log(msg); }}
            ref={ (client) => { this.clientRef = client }} />
      </div>
    );
  }
}

Demonstration

https://react-websocket.herokuapp.com/index

A working implementation using Spring Boot and react-talk can be found at https://github.com/lahsivjar/spring-websocket-template/tree/master/with-sockjs

API Docs

Auto generated docs available here.

Issues

Report any issues or bugs to https://github.com/lahsivjar/react-stomp/issues

Changelog

5.1.0

  • Fix subscribeHeaders corruption when subscribing to multiple topics
  • Minor upgrades:
    • sinon
    • nyc
    • acorn
    • websocket-extensions
    • handlebars
    • lodash
    • sockjs-client
    • highlightjs
    • ini

5.0.0

  • Update react from 16.6.3 to 16.13.0
  • Fix deprecation of componentWillReceiveProps

4.3.0

  • Update handlebar dependency

4.2.0

  • Add onConnectFailure callback
  • Upgrade babel to babel7

4.1.1

  • [BugFix #96] Remove array slice of subscribe headers

4.1.0

  • Update react from 16.5.0 to 16.6.3
  • Update react-dom from 16.5.0 to 16.6.3
  • [PR #93] Use STOMP message frame to find correct topic

4.0.0

  • Improve test coverage
  • [BugFix #61] Add support for receiving plain text messages
  • [BugFix #70] Fix reconnect loop under certain circumstances even after disconnect is called

License

This project is licensed under the MIT License - see the LICENSE file for details

Keywords

FAQs

Last updated on 16 Jan 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc