I am currently grappling with disconnection issues while implementing WebSocket communication with Stomp in a React application on iOS devices.
The Stomp server, integral to the architecture, is hosted on a Spring Boot application.
The communication between the React application and the Stomp server is facilitated by the esteemed react-stomp-hooks library.
Currently I have encounter 2 issues.
Issue 1: Disconnection Post-Device Unlock
Upon entering the React application via the browser(safari), seamless functionality ensues. However, when the device undergoes the transition from a locked to an unlocked state, The attempts to communicate with the Stomp server yield an absence of transmitted messages. This is fix by refreshing the page.
Issue 2: Absence of Communication on Homepage Integration
While saving the web application as shortcut on iOS device’s homepage, No connection has been implemented to the Stomp server.
Stomp Server URL:
https://stomp.domain.com
The library I am using to interact with the stomp server: react-stomp-hooks
Sample of my code thats shows how I am integrating with the Stomp server:
export default function App() {
useScrollToTop();
return (
<ThemeProvider>
<StompSessionProvider url={STOMP_SERVER}>
<Router/>
</StompSessionProvider>
</ThemeProvider>
);
}
const stompClient = useStompClient();
useSubscription(generateStompSubscriptionUrl(scaleId), (message) => {
handleTerminalChange(message.body)
});
const sendMessage = (message) => {
if (stompClient) {
stompClient.publish({
destination: generateStompSendDestinationUrl(scaleId),
body: message,
});
} else {
//Handle error
}
};
- Are there specific configurations or settings that demand adjustment to circumvent these disconnection challenges on iOS devices?
- Is there available insight into whether Apple may be implementing restrictions on WebSocket connections within web applications for specific reasons?