-
Notifications
You must be signed in to change notification settings - Fork 95
Open
Description
Environment
- Frontend: React Native
- Backend: Spring with STOMP
- React Native Version:
v13.6.6 stompjsVersion:v.7.4.0
Issue
- The logs keep showing me the connection is opened and closed immediately.
- I saw documentations about React Native issues but had no chance after setting below:
text-encodingappendMissingNullonIncoming: trueforceBinaryWSFrames: true- Also tried downgrading to
5.4.0where community says it worked but didn't for me
LOG Opening Web Socket...
LOG Connection closed to ws://localhost:8080/ws
LOG STOMP: scheduling reconnection in 5000ms
Code
websocket.js
import { Client } from '@stomp/stompjs';
const socketUrl = 'ws://localhost:8080/ws';
export const connectWebSocket = () => {
let client = new Client({
brokerURL: socketUrl,
debug: (str) => {
console.log(str);
},
appendMissingNULLonIncoming: true,
forceBinaryWSFrames: true,
onConnect: () => {
console.log('Connected');
},
});
client.activate();
}App.jsx
import * as encoding from 'text-encoding';
import {connectWebSocket} from "./src/config/websocket";
Object.assign(global, encoding)
useEffect(() => {
connectWebSocket();
}, []);Have I been doing anything wrong?
Metadata
Metadata
Assignees
Labels
No labels