Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to add socket.io-client in angular getting 404 #1065

Closed
ahadcove opened this issue Feb 6, 2017 · 7 comments
Closed

Trying to add socket.io-client in angular getting 404 #1065

ahadcove opened this issue Feb 6, 2017 · 7 comments

Comments

@ahadcove
Copy link

ahadcove commented Feb 6, 2017

I am Trying to add socket.io-client in angular 2.
I already installed the modules and all and probably more than I need of the typings:

npm install @types/socket.io --save-dev
npm install @types/socket.io-client --save-dev
typings install dt~socket.io-client --save --global
typings install dt~socket.io --save --global

And I tried importing it in my component attempting two different ways:

import * as io from "socket.io-client";
//declare var io:any;

Yet, im still getting this error in my browser:

http://localhost:4200/socket.io/?EIO=3&transport=polling&t=LeKQjxc 404 (Not Found)
@crebuh
Copy link

crebuh commented Feb 14, 2017

same problem for me, I currently trying to connect to a test socket from wss://echo.websocket.org but automatically /socket.io/ is added which leads to a 404-response

@andreykaipov
Copy link

andreykaipov commented Apr 16, 2017

Any updates? I'm getting the same thing trying to integrate socket.io into our app. Using Angular CLI, installed the types, and included them in the tsconfig.app.json, but I'm still getting the same 404 error. Seems like it works for everybody else, but not for us!

@darrachequesne
Copy link
Member

Could you please provide the configuration for the server?

@andreykaipov
Copy link

@darrachequesne Hi! Yup it worked after I checked the server configuration the next day. It was a really silly oversight on my part... Sorry for bumping the issue! Not sure about the others above though. Thanks again!

@darrachequesne
Copy link
Member

@crebuh you won't be able to connect to wss://echo.websocket.org, as socket.io is not a Websocket implementation (it uses Websocket as a possible transport).

@ahadcove Could you please provide the configuration for the server?

@crebuh
Copy link

crebuh commented Apr 22, 2017

@darrachequesne our problem was the nginx configuration we had to add this location

location ~/(socket\.io).*$ { proxy_pass http://127.0.0.1:6005; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; }

then it worked :)

@darrachequesne
Copy link
Member

@crebuh great! I think we can close this issue now, please reopen if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants