Skip to content

[🚀 Feature]: [py] Allow determining the order of CDP and BiDi events #16280

@nxs7

Description

@nxs7

Description

This request is essentially the same as #13845, but for Python binding.

In WebSocketConnection._process_message, callback invocations are executed in separate threads:

Thread(target=callback, args=(params,)).start()

This could disrupt the original ordering of callback invocations, which is problematic for certain CDP events. For example, HeapProfiler.addHeapSnapshotChunk provides only a chunk parameter and relies entirely on the order of invocation to correctly reconstruct the snapshot.

It would be helpful if the callback function WebSocketConnection.add_callback accepts could have an additional order parameter to allow enforcing sequential ordering when needed.

Have you considered any alternatives or workarounds?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-devtoolsIncludes everything BiDi or Chrome DevTools relatedC-pyPython BindingsI-enhancementSomething could be better

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions