Skip to content

Add WebSocket Client Replay #5248

@mhils

Description

@mhils

Problem Description

We have a client-side replay feature where you provide a previously saved HTTP conversation, and mitmproxy replays the client requests one by one. This is incredibly useful in testing, for example to test an API with a predefined set of requests. However, mitmproxy does not support replaying WebSocket or TCP flows yet.

Proposal

It would be really nice if we'd have some way to replay WebSocket connections as well. This is a bit trickier than HTTP as there are multiple messages within a WebSocket flow and we need to figure out when to send them. To get things rolling, we could start with a simple implementation that naively tries to recreate the original conversation. For example, if we have the following flow:

Client: Hello
Server: Hello
Client: World
Server: World

In this case mitmproxy should first send "Hello", then wait for the server's "Hello", then send "World", and wait for the server's "World". In a second step, one could think of a replay feature where mitmproxy replays the client messages using the original timing information instead of waiting for the server to reply.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions