Issue
I've recently started using ngx-socket-io, and i've run into some difficultys as i wanted to retreive the socket id. Does anyone know how this can be done ? (I'm using the service intialization not the one in the app Module) Thank you in advance.
Solution
import { Socket } from 'ngx-socket-io';
constructor(private socket: Socket) {}
ngOnInit() {
this.socket.on('connect', () => console.log(this.socket.ioSocket.id));
}
Answered By - FBaez51
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.