mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-26 09:30:37 +00:00
proxy: swap tungstenite for a simpler impl (#7353)
## Problem I wanted to do a deep dive of the tungstenite codebase. tokio-tungstenite is incredibly convoluted... In my searching I found [fastwebsockets by deno](https://github.com/denoland/fastwebsockets), but it wasn't quite sufficient. This also removes the default 16MB/64MB frame/message size limitation. framed-websockets solves this by inserting continuation frames for partially received messages, so the whole message does not need to be entirely read into memory. ## Summary of changes I took the fastwebsockets code as a starting off point and rewrote it to be simpler, server-only, and be poll-based to support our Read/Write wrappers. I have replaced our tungstenite code with my framed-websockets fork. <https://github.com/neondatabase/framed-websockets>
This commit is contained in:
@@ -135,7 +135,14 @@ async def test_websockets_pipelined(static_proxy: NeonProxy):
|
||||
query_message = "SELECT 1".encode("utf-8") + b"\0"
|
||||
length2 = (4 + len(query_message)).to_bytes(4, byteorder="big")
|
||||
await websocket.send(
|
||||
[length0, startup_message, b"p", length1, auth_message, b"Q", length2, query_message]
|
||||
length0
|
||||
+ startup_message
|
||||
+ b"p"
|
||||
+ length1
|
||||
+ auth_message
|
||||
+ b"Q"
|
||||
+ length2
|
||||
+ query_message
|
||||
)
|
||||
|
||||
startup_response = await websocket.recv()
|
||||
|
||||
Reference in New Issue
Block a user