javascript – WebSocket Disconnection on iOS Gadgets with React and Stomp Integration

Spread the love


I’m at the moment grappling with disconnection points whereas implementing WebSocket communication with Stomp in a React utility on iOS units.

The Stomp server, integral to the structure, is hosted on a Spring Boot utility.

The communication between the React utility and the Stomp server is facilitated by the esteemed react-stomp-hooks library.

Presently I’ve encounter 2 points.

Subject 1: Disconnection Put up-System Unlock

Upon coming into the React utility through the browser(safari), seamless performance ensues. Nonetheless, when the system undergoes the transition from a locked to an unlocked state, The makes an attempt to speak with the Stomp server yield an absence of transmitted messages. That is repair by refreshing the web page.

Subject 2: Absence of Communication on Homepage Integration

Whereas saving the online utility as shortcut on iOS system’s homepage, No connection has been applied to the Stomp server.

Stomp Server URL:
https://stomp.area.com

The library I’m utilizing to work together with the stomp server: react-stomp-hooks

Pattern of my code thats reveals how I’m integrating with the Stomp server:


export default operate App() {
    useScrollToTop();

    return (
        <ThemeProvider>
            <StompSessionProvider url={STOMP_SERVER}>
                <Router/>
            </StompSessionProvider>
        </ThemeProvider>
    );
}

const stompClient = useStompClient();
    useSubscription(generateStompSubscriptionUrl(scaleId), (message) => {
        handleTerminalChange(message.physique)
    });
    const sendMessage = (message) => {
        if (stompClient) {
            stompClient.publish({
                vacation spot: generateStompSendDestinationUrl(scaleId),
                physique: message,
            });
        } else {
            //Deal with error
        }
    };

  1. Are there particular configurations or settings that demand adjustment to avoid these disconnection challenges on iOS units?
  2. Is there out there perception into whether or not Apple could also be implementing restrictions on WebSocket connections inside internet functions for particular causes?

Leave a Reply

Your email address will not be published. Required fields are marked *