React App using socket.io client tries to make a connection to http://127.0.0.1:50005/socket.io/?EIO=3&transport=polling&t=MLY0Fkf, but I am using a remote socket server + enforcing websocket transport
See original GitHub issueYou want to:
- report a bug
- request a feature
Current behaviour
Users are seeing this error in their browser, as well as myself on my local environment:
Steps to reproduce (if the current behaviour is a bug)
const io = require('socket.io-client')
var socket_url = `http://[REMOTE_WEBSOCKET_HOST]`; //~ TODO: move this somewhere else
var socket = io(socket_url, {transports: ['websocket']});
Note that the socket server is remote but socket.io is still trying to open a localhost connection on every end user browser.
Expected behaviour
It should not attempt to connect to this localhost socket. Note: socket.io is working as expected otherwise, this is just an error that users are reporting they are seeing.
Setup
- OS: macOS High Sierra 10.13.6
- browser: Google Chrome Version 68.0.3440.106 (Official Build) (64-bit)
- socket.io version: socket.io-client 2.1.1
Other information (e.g. stacktraces, related issues, suggestions how to fix)
polling-xhr.js:263 GET http://127.0.0.1:50005/socket.io/?EIO=3&transport=polling&t=MLY0Fkf 0 ()
./node_modules/engine.io-client/lib/transports/polling-xhr.js.Request.create @ polling-xhr.js:263
Request @ polling-xhr.js:165
./node_modules/engine.io-client/lib/transports/polling-xhr.js.XHR.request @ polling-xhr.js:92
./node_modules/engine.io-client/lib/transports/polling-xhr.js.XHR.doPoll @ polling-xhr.js:122
./node_modules/engine.io-client/lib/transports/polling.js.Polling.poll @ polling.js:118
./node_modules/engine.io-client/lib/transports/polling.js.Polling.doOpen @ polling.js:63
./node_modules/engine.io-client/lib/transport.js.Transport.open @ transport.js:80
./node_modules/engine.io-client/lib/socket.js.Socket.open @ socket.js:245
Socket @ socket.js:119
Socket @ socket.js:28
./node_modules/socket.io-client/lib/manager.js.Manager.open.Manager.connect @ manager.js:226
Manager @ manager.js:69
Manager @ manager.js:37
lookup @ index.js:60
Promise.race.Promise @ scatter.esm.js:128
link @ scatter.esm.js:127
resolve @ scatter.esm.js:569
connect @ scatter.esm.js:553
_callee5$ @ ScatterStore.js:379
tryCatch @ runtime.js:62
invoke @ runtime.js:296
prototype.(anonymous function) @ runtime.js:114
step @ OrderEntryStore.js:106
(anonymous) @ OrderEntryStore.js:106
(anonymous) @ OrderEntryStore.js:106
ScatterStore @ ScatterStore.js:432
./src/stores/index.js @ index.js:23
__webpack_require__ @ bootstrap d1fd0316e478a1070bc5:678
fn @ bootstrap d1fd0316e478a1070bc5:88
./src/index.js @ index.css?f255:26
__webpack_require__ @ bootstrap d1fd0316e478a1070bc5:678
fn @ bootstrap d1fd0316e478a1070bc5:88
0 @ index.js:27
__webpack_require__ @ bootstrap d1fd0316e478a1070bc5:678
(anonymous) @ bootstrap d1fd0316e478a1070bc5:724
(anonymous) @ bootstrap d1fd0316e478a1070bc5:724
10:19:17.353
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Client Initialization
A Manager instance is in charge of the low-level connection to the server (established with HTTP long-polling or WebSocket). It handles the ...
Read more >Troubleshooting connection issues
First and foremost, please note that disconnections are common and expected, even on a stable Internet connection:
Read more >Troubleshooting connection issues
You are trying to reach a plain WebSocket server; The server is not reachable; The client is not compatible with the version of...
Read more >Client API
IO client instance, which is the low-level engine that establishes the connection to the server (by using transports like WebSocket or HTTP ...
Read more >Introduction | Socket.IO
Under some particular conditions, the WebSocket connection between the server and the client can be interrupted with both sides being unaware of ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@acoutts Same error while running on a socket
The Error 👍 POST http://localhost:3000/socket.io/?EIO=3&transport=polling&t=MSwHsDu 404 (Not Found)
Closing as this appears to be an issue in the
scatter-js
package.