ng-socket-io
ng-socket-io copied to clipboard
How to dispose and recreate socket?
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