You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a52e5b7
Browse filesBrowse the repository at this point in the historyBrowse files
Make WebSocketClient retain and reuse one private subscription object.
Require explicit non-empty events for create_subscription; reject pending
or active duplicate creation via the existing createSubscriptionError path
while routing retries after failure and creation after removal through the
retained object's existing registration flow with the newly supplied events.
events (list, optional): A list of events to subscribe to. Default is None.
258
+
events (list): A required, non-empty list of events to subscribe to.
258
259
259
260
Raises:
260
-
Exception: If any error occurs during the processor if the connection is not ready after multiple attempts.
261
+
Exception: If any error occurs during the process, if events are omitted, None, or empty, if a subscription creation is already in progress, or if a subscription already exists.
261
262
262
263
Note:
263
-
- If the WebSocket connection is ready (`_is_ready` flag), resets the send attempt counter and creates a WebSocketSubscription instance.
264
-
- Registers the subscription with the specified events.
264
+
- Events are required: an omitted argument is rejected by ordinary Python argument checking, and None or empty events raise "Events are undefined" before any request is sent or any receive listener is attached.
265
+
- The client retains and reuses a single subscription object; a retry after a failed creation and a creation after removal reuse the retained object's existing registration flow with the newly supplied events.
266
+
- Rejects a call while a subscription creation is already in progress with "WebSocket subscription creation is already in progress; wait for subscriptionCreated or createSubscriptionError before retrying".
267
+
- Rejects a call after a subscription has been created with "A WebSocket subscription already exists; use update_subscription() to change its events or remove_subscription() before creating another".
268
+
- Rejections are delivered through the createSubscriptionError event and raised to the caller.
269
+
- If the WebSocket connection is ready (`_is_ready` flag), resets the send attempt counter and registers the retained subscription with the specified events.
265
270
- If the connection is not ready, retries after a delay and increments the send attempt counter.
266
271
- If the send attempt counter exceeds a threshold, triggers the connectionNotReady event and raises an exception.
raiseException("WebSocket subscription creation is already in progress; wait for subscriptionCreated or createSubscriptionError before retrying")
283
+
ifsubscription.get_subscription_info() isnotNone:
284
+
raiseException("A WebSocket subscription already exists; use update_subscription() to change its events or remove_subscription() before creating another")
0 commit comments