Updated typing for WebsocketMessage.content
diff --git a/CHANGELOG b/CHANGELOG
index ecf7394866..85891f243c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,7 @@ Unreleased: mitmproxy next
 
     * Add MsgPack content viewer (@tasn)
     * Fix links to anticache docs in mitmweb and use HTTPS for links to documentation (@rugk)
+    * Updated typing for WebsocketMessage.content (@prinzhorn)
 
     * --- TODO: add new PRs above this line ---
 
diff --git a/mitmproxy/websocket.py b/mitmproxy/websocket.py
index 3468ec0e2a..9ab26deabc 100644
--- a/mitmproxy/websocket.py
+++ b/mitmproxy/websocket.py
@@ -1,6 +1,6 @@
 import time
 import queue
-from typing import List, Optional
+from typing import List, Optional, Union
 
 from wsproto.frame_protocol import CloseReason
 from wsproto.frame_protocol import Opcode
@@ -17,7 +17,7 @@ class WebSocketMessage(serializable.Serializable):
     """
 
     def __init__(
-        self, type: int, from_client: bool, content: bytes, timestamp: Optional[float]=None, killed: bool=False
+        self, type: int, from_client: bool, content: Union[bytes, str], timestamp: Optional[float]=None, killed: bool=False
     ) -> None:
         self.type = Opcode(type)  # type: ignore
         """indicates either TEXT or BINARY (from wsproto.frame_protocol.Opcode)."""

#### Description

Fixes https://github.com/mitmproxy/mitmproxy/issues/4131
I have no idea about Python typing, I copied this from StackOverflow like a professional.

#### Checklist

 - [x] I have updated tests where applicable.
 - [x] I have added an entry to the CHANGELOG.
