1.0.3 • Published 4 years ago

react-spring-websocket v1.0.3

Weekly downloads
7
License
MIT
Repository
github
Last release
4 years ago

React - Spring-Boot Websocket.

Developed and maintained with 🥰 by Rancard Solutions.

A declarative library based on Typescript to easily connect to server through websocket using the STOMP protocal.

Installation

To install the library kindly run npm install react-spring-websocket or yarn add react-spring-websocket in your terminal

Import

import SpringSocket from "react-spring-websocket"

Usage

// create a socket connection
const socket = new SpringSocket(
  "socket-enpoint-1",
  ["subscriptionEndpoint1", "subscriptionEndpoint2", "sub..."],
  (message1) => {
    console.log(message1)
  }
)

// create a socket connection 2
const socket2 = new SpringSocket(
  "socket-enpoint-2",
  ["subscriptionEndpoint3", "subscriptionEndpoint4", "sub..."],
  (message2) => {
    console.log(message2)
  }
)


//Send Message
socket.send("/message-mapping-endpoint", {name:"Archibold Bernard"})

socket2.send("/message-mapping-endpoint-2", "This is awesome")
1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago