From b18d2960a3bb07408fe0b5fdbe7bf6e8e69e5794 Mon Sep 17 00:00:00 2001 From: Ciro Date: Thu, 19 Jan 2023 15:56:43 -0300 Subject: [PATCH] add clone method in websocket --- src/socketify/socketify.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/socketify/socketify.py b/src/socketify/socketify.py index 0bcbe83..2af0a84 100644 --- a/src/socketify/socketify.py +++ b/src/socketify/socketify.py @@ -1143,6 +1143,11 @@ class WebSocket: self.socket_data = None self.got_socket_data = False + + def clone(self): + # clone and preserve this websocket in another instance + return WebSocket(self.websocket, self.app) + def trigger_for_each_topic_handler(self, topic): if hasattr(self, "_for_each_topic_handler") and hasattr( self._for_each_topic_handler, "__call__"