Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including react-stomp with all npm packages installed. Try it out:

var reactStomp = require("react-stomp")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

react-stomp v4.2.0

React websocket component with STOMP over SockJS


Build Status Coverage Status License Greenkeeper badge js-standard-style

React component for SockJS-client with STOMP messaging protocol.


npm install --save react-stomp

Example Usage

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

class SampleComponent extends React.Component {
  constructor(props) {

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

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


A working implementation using Spring Boot and react-talk can be found at

API Docs

Auto generated docs available here.


Report any issues or bugs to



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


  • 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


  • 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


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

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free