I’ve installed Socket.io client and typings:
npm install socket.io-client --save
typings install dt~socket.io-client --save --global
ambient
is deprecated in favor of globals
.
@Jose_Ionic Using the client in Ionic 2 is simple as:
import * as io from "socket.io-client";
...
export class YourClass {
socket: SocketIOClient.Socket;
...
connect() {
this.socket = io(SOCKET_URL);
this.socket.on('connect', () => {
...
});
}
}
Have fun!