Reputation: 19
I am using Strophe.js (JS based Xmpp library). The problem is that I need to establish synchronous connections so that the responses I receive are in the correct order. But when I use synchronous connections, the page sort of becomes stuck. Even a right-click to open the console takes minutes.
I get this warning on page:
[Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
Please help!
Upvotes: 1
Views: 127
Reputation: 2183
The warning just tells you that it is greatly preferred to use async calls, for a reason.
A synchronous call will block the rest of your code until a response has been received. Somehow, it takes a long time for your synchronous call to return.
Without looking at your code it is hard to tell why, but you could try retrieving the resource you are trying to get by typing its URL in in a browser and see how long it takes to get a response, or if you get a response at all, and if you see any errors.
If the resource can't be retrieved or is slow in coming, you know where the problem is and where to fix it.
There are some ways of getting XMLHttpRequest
results in the right order:
Upvotes: 1