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

How to dispose and recreate socket?

Open DJDaveMark opened this issue 6 years ago • 0 comments

Hi,

I'd like some pointers on how to dispose and recreate the socket connection. At the moment, in the AppModule I have SocketIoModule.forRoot(socketConfig), and a single page/component which uses a service which has the Socket class injected via it's contructor. The service obviously stays around as soon as it's instantiated for the first time, by navigating to the page.

Does anyone have any advice or example code to dispose & recreate the socket? Or another pattern like creating/disposing a new socket which follows the life-cycle of a component?

Cheers

DJDaveMark avatar Jul 25 '18 08:07 DJDaveMark