Reactjs React Native和Websockets(sockets.io)的XMLHttpRequest错误
我在使用sockets.io时遇到问题。我有一台运行sockets.io的服务器,希望通过(android版本的)React本机连接到此服务器。但是,我当前在执行时遇到以下错误:Reactjs React Native和Websockets(sockets.io)的XMLHttpRequest错误,reactjs,react-native,websocket,xmlhttprequest,Reactjs,React Native,Websocket,Xmlhttprequest,我在使用sockets.io时遇到问题。我有一台运行sockets.io的服务器,希望通过(android版本的)React本机连接到此服务器。但是,我当前在执行时遇到以下错误: \node_modules\react-native\Libraries\Core\ExceptionsManager.js:63 Failed to set the 'responseType' property on 'XMLHttpRequest': The response type cannot be set
\node_modules\react-native\Libraries\Core\ExceptionsManager.js:63 Failed to set the 'responseType' property on 'XMLHttpRequest': The response type cannot be set after the request has been sent.
我不确定要粘贴什么相关代码,因为它并没有真正告诉我失败的地方,我自己也没有直接调用XMLHttpRequest,但我想这是因为它将套接字io连接转换为XMLHttp。虽然我不是100%确定这一点,这只是我在网上学到的东西,但这对我来说是一个相当新的话题
有人能对此提供一些见解吗
以下是完整的堆栈跟踪:
对于后代来说,这就是解决办法。 我不得不从: const socket=io.connect(`${BASECONNECTION}:${PORT}`) 致:
const socket=io(`${BASECONNECTION}:${PORT}`,{transports:['websocket']}) 错误是截断来自哪个库。这些信息可以帮助我们帮助你。完全正确,我太傻了。更新并添加了完整堆栈跟踪:)