angular-socket-io icon indicating copy to clipboard operation
angular-socket-io copied to clipboard

socket.io 404 (Not Found)

Open ghost opened this issue 9 years ago • 4 comments

Hey,

I'm trying to use angular-socket-io in my project that uses grunt serve command to run the Gruntfile.js. Here's what I have done:

  1. Downloaded angular-socket-io and socket.io-client via bower
  2. Added angular-socket-io and socket.io-client libraries in my index.html page
  3. Added btford.socket-io in my app.module at app.js file
  4. Added following code to my Socket.js file which is located in same folder than app.js: app.factory('Socket', function (socketFactory) { return socketFactory(); });

Yet I get following error:

GET http://127.0.0.1:9000/socket.io/?EIO=3&transport=polling&t=1448710127650-0 404 (Not Found)

Problem is very obvious. It simply can't find socket.io library. I have installed socket.io via npm. Is it somehow possible to tell angular-socket-io module the location of socket.io that was downloaded via npm?

ghost avatar Nov 28 '15 11:11 ghost

I experienced a similar problem when trying to integrate socket.io by itself (without btford.socket-io). In my index.html I changed the file path from:

<script type="text/javascript" src="lib/socket.io/lib/socket.js"></script>

to

<script type="text/javascript" src="/socket.io/socket.io.js"></script>

As the documentation suggests. I haven't integrated btford.socket-io into my project just yet so this may not answer your problem because the included javascript file is different from the ones downloaded via NPM.

nylin93 avatar Jan 06 '16 17:01 nylin93

Here is a possible answer: http://howtodevelop.eu/question/reactjs-node-js-socket-io-wont-work-connect-in-reactjs-app,115692#

i.e on your server.js side: server.listen(port) instead of app.listen(port) !

Also you may need on your client.js side: const io = require('socket.io-client')

pifpafpof-thomasL avatar Feb 01 '17 15:02 pifpafpof-thomasL

i have the same issue. http://localhost/socket.io/?EIO=3&transport=polling&t=MQaU_0i 404 (Not Found)

DevChrisDev avatar Oct 24 '18 05:10 DevChrisDev

@DevChrisDev Did you solve this problem?I am getting same error...

sebnemdemircioglu avatar Apr 18 '20 12:04 sebnemdemircioglu