I am trying to use a library Socket.io-clientin an Angular 2 application.
There are several different quick change guides that Angular 2 has over the past couple of months.
I do not know that I am doing something wrong.
What I've done?
npm install socket.io-client
After that in the component:
...
import * as io from "socket.io-client";
...
export class MyComponent implements OnInit {
socket: SocketIOClient.Socket;
constructor() {
this.socket = io.connect("http://localhost:4200");
this.socket.on("connection", () => console.log("this is onl a test"));
}
}
}
When I open the console, I see the following errors:
GET http://localhost:4200/socket.io/?EIO=3&transport=polling&t=LdBXte5 404 (Not Found)
source
share