我尝试使用 https://github.com/jmesnil/stomp-websocket和 https://github.com/JSteunou/webstomp-client
我的服务器使用Spring-boot
我的代码:
var Stomp = require('stompjs/lib/stomp.js').Stomp;
let client = Stomp.client(url);
client.connect({}, function connectCallback(frame){
console.log('OK')
}, (error) => {
console.log('Error');
});
两者都适用于 IOS,但在 Android 中无法连接到服务器。
Web Socket Opened...
CONNECT
accept-version:1.1,1.0
heart-beat:10000,10000
Whoops! Lost connection
Error
最佳答案
如 Max 所述- 问题是 android 没有发送\x00。
请在此处检查解决方案 https://stackoverflow.com/a/48623125/1869260
关于android - react native : Stomp websocket not working in android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47598305/