npm i global-websocket-client
import React, { Component } from "react";
import WebSocketClient from "../../src";
class Demo extends Component {
state = {
WebSocketUri: 'wss://echo.websocket.org'
};
componentDidMount(){
WebSocketClient.connect(
this.state.WebSocketUri,
this.openCallback,
this.onErrorCallback,
this.onMessageCallback,
this.onCloseCallback
);
};
render() {
return (
<div>
<h1>global-websocket-client</h1>
</div>
);
}
}