Modify websocket messages #913
-
Hello, |
Beta Was this translation helpful? Give feedback.
Answered by
abhinavsingh
Dec 27, 2021
Replies: 1 comment 5 replies
-
Does something like this work for you, can you double check? You should see class ModifyWebsocketResponsePlugin(HttpProxyBasePlugin):
"""Inspect/Modify/Send custom websocket responses."""
def handle_upstream_chunk(self, chunk: memoryview) -> memoryview:
remaining = chunk.tobytes()
while len(remaining) > 0:
response = WebsocketFrame()
remaining = response.parse(remaining)
self.client.queue(memoryview(
WebsocketFrame.text(b"modified websocket response")
))
return memoryview(b'') If it works, we should check-in this plugin as a starting point within the repo, probably with some documentation. Let me know. |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
abhinavsingh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does something like this work for you, can you double check? You should see
modified websocket response
in websocket responses on the client side.If it works, we should check-in this plugin as …