Hi, I can't get SockJS Client to subscribe to the 'initial/queue' and 'dashboard/livestream' topic. I only get 'topic/livestream', no matter what I do.
Here is my code snippet, and also a reminder that in the backend everything is configured fine, so the problem is somewhere either in this logic or in SockJs library. Please help!
import React from 'react';
import SockJsClient from 'react-stomp';
Hi, I can't get SockJS Client to subscribe to the 'initial/queue' and 'dashboard/livestream' topic. I only get 'topic/livestream', no matter what I do. Here is my code snippet, and also a reminder that in the backend everything is configured fine, so the problem is somewhere either in this logic or in SockJs library. Please help!
import React from 'react'; import SockJsClient from 'react-stomp';
class TableDataStream extends React.Component { constructor(props) { super(props); this.state = { clientConnected: false, messages: [], data: [], circulatingSupply: '', figures: '', initialDataReceived: false }; }
componentDidMount() { this.setState({ clientConnected: true }); }
componentWillUnmount() { this.setState({ clientConnected: false }); }
sendMessage = () => { if (this.clientRef && this.clientRef.state && this.clientRef.state.connected) { console.log(this.clientRef); console.log(this.clientRef.state); console.log(this.clientRef.state.connected); this.clientRef.sendMessage('/dashboard/livestream', {}); } };
handleMessage = (event) => { if (event.topic === '/queue/initial') {
};
handleDisconnect = () => { console.log('SockJSClient is disconnected'); };
render() { const { initialDataReceived, clientConnected } = this.state;
} }
export default TableDataStream;