clear

fun clear()

Cancels all coroutines launched by this WebSocketManager.

This effectively stops all ongoing operations including sending, receiving, and reconnect attempts.

  • The coroutineScope is cancelled along with all its child jobs.

  • An optional cancellation cause can be provided internally for debugging purposes.

After calling this method, the WebSocketManager cannot be used until a new instance is created.

Example usage:

wsManager.clear()