Клиент JS Stomp не подключаетсяHtml

Программисты Html
Ответить
Anonymous
 Клиент JS Stomp не подключается

Сообщение Anonymous »

Я пытаюсь подключиться к «серверу Stomp» и инициализировал соединение, однако мой код застрял на Stomp: Открытие Web Socket в течение примерно 5 минут, а затем, наконец, говорит, что соединение не удалось. Я успешно попытался связаться с Python (мой основной язык), однако мой друг хотел, чтобы подключение было добавлено на его веб -сайт, поэтому я подумал с моим очень небольшим опытом, я бы попробовал. Я полагаю, что Brokerurl является правильным, так как ранее он мгновенно провалил связь, тогда как теперь он провалится через 5 минут. />EDIT: I have used wireshark to monitor the data being sent back and forth, and have noticed that when the below code runs, it does a GET / HTTP 1.1 request, which doesnt happen when I run the python equivalent, and the next packet monitored is the connection being rejected so im even more lost
Here is my code to connect:
let stompClient;

const stompConfig = {
brokerURL: "ws://xxx.xx.xx.xxx:port",

// Keep it off for production, it can be quit verbose
// Skip this key to disable
debug: function (str) {
console.log('STOMP: ' + str);
},

// If disconnected, it will retry after 200ms
reconnectDelay: 200,

// Subscriptions should be done inside onConnect as those need to reinstated when the broker reconnects
onConnect: function (frame) {
// The return object has a method called `unsubscribe`
const subscription = stompClient.subscribe('/topic/TD_ALL_SIG_AREA', function (message) {
const payload = JSON.parse(message.body);
console.log(payload)
})

console.log("Connected to Simsig!")
stompClient.publish({destination: '/topic/TD_ALL_SIG_AREA', body: "{snapshot:{}}"});
}
}

// Create an instance
stompClient = new StompJs.Client(stompConfig);

// You can set additional configuration options here

// Attempt to connect
stompClient.activate();


Подробнее здесь: https://stackoverflow.com/questions/796 ... nt-connect
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Html»