aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2020-05-13 16:11:15 +0200
committerGitHub <noreply@github.com>2020-05-13 16:11:15 +0200
commitb4bd1741eb48971a62b26d366bc6e2768350783e (patch)
tree25d6167f6a77739e58a7e9ef2d3bbd5c6e4e8197
parent3372b77e93c7adf98f6d067bf7bb01ded42054c0 (diff)
parent479d4cda9bb76bfb64d64642fb12ff05db2e7ae0 (diff)
downloadmitmproxy-b4bd1741eb48971a62b26d366bc6e2768350783e.tar.gz
mitmproxy-b4bd1741eb48971a62b26d366bc6e2768350783e.tar.bz2
mitmproxy-b4bd1741eb48971a62b26d366bc6e2768350783e.zip
Merge pull request #3992 from JustAnotherArchivist/ws-message-timestamp-float
Record float timestamp for WebSocket messages instead of truncating to int
-rw-r--r--mitmproxy/websocket.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/mitmproxy/websocket.py b/mitmproxy/websocket.py
index f13b9eec..3468ec0e 100644
--- a/mitmproxy/websocket.py
+++ b/mitmproxy/websocket.py
@@ -17,7 +17,7 @@ class WebSocketMessage(serializable.Serializable):
"""
def __init__(
- self, type: int, from_client: bool, content: bytes, timestamp: Optional[int]=None, killed: bool=False
+ self, type: int, from_client: bool, content: bytes, timestamp: Optional[float]=None, killed: bool=False
) -> None:
self.type = Opcode(type) # type: ignore
"""indicates either TEXT or BINARY (from wsproto.frame_protocol.Opcode)."""
@@ -25,7 +25,7 @@ class WebSocketMessage(serializable.Serializable):
"""True if this messages was sent by the client."""
self.content = content
"""A byte-string representing the content of this message."""
- self.timestamp: int = timestamp or int(time.time())
+ self.timestamp: float = timestamp or time.time()
"""Timestamp of when this message was received or created."""
self.killed = killed
"""True if this messages was killed and should not be sent to the other endpoint."""