https://github.com/lahsivjar/react-stomp
React websocket component for STOMP protocol over SockJs
https://github.com/lahsivjar/react-stomp
reactjs sockjs-client stompclient websocket-client
Last synced: about 1 year ago
JSON representation
React websocket component for STOMP protocol over SockJs
- Host: GitHub
- URL: https://github.com/lahsivjar/react-stomp
- Owner: lahsivjar
- License: mit
- Created: 2017-12-10T06:42:01.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T16:20:12.000Z (over 3 years ago)
- Last Synced: 2025-03-29T07:07:42.967Z (about 1 year ago)
- Topics: reactjs, sockjs-client, stompclient, websocket-client
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/react-stomp
- Size: 1.17 MB
- Stars: 136
- Watchers: 7
- Forks: 42
- Open Issues: 49
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-stomp
[](https://travis-ci.com/lahsivjar/react-stomp?branch=master) [](https://coveralls.io/github/lahsivjar/react-stomp?branch=master) [](https://github.com/lahsivjar/react-stomp/blob/master/LICENSE) [](https://github.com/standard/standard)
React component for [SockJS-client](https://github.com/sockjs/sockjs-client) with [STOMP](https://stomp.github.io/) messaging protocol.
## Installation
```sh
npm install --save react-stomp
```
## Example Usage
```jsx
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 (
{ console.log(msg); }}
ref={ (client) => { this.clientRef = client }} />
);
}
}
```
## Demonstration
A working implementation using [Spring Boot](https://projects.spring.io/spring-boot/) and [react-talk](https://github.com/lahsivjar/react-talk) can be found at
## API Docs
Auto generated docs available [here](API.md).
## Issues
Report any issues or bugs to
## 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](LICENSE) file for details