API Gateway Websockets size limit Feedback

0

Why is the APi gateway websockets size limit so low (128k)?

This is pretty small, and frustrating.

Also, when you try and send too much data to the client, it didn't give me any errors the response just doesn't go through (lambda and websockets both logging a success).

It's a pretty cool service otherwise. Thanks for developing it!

已提问 4 年前2040 查看次数
7 回答
1

This looks like a WS client issue. I tried with websockets (python), websocket-client (python) and wscat.

Working client : websocket and asyncio (python)

async def hello():
    uri = "wss://<api>.execute-api.us-west-2.amazonaws.com/<stage>/"
    async with websockets.connect(uri, ssl=ssl._create_unverified_context()) as websocket:
        name = "<some large msg>"

        await websocket.send(name)
        print(f"> large")

        greeting = await websocket.recv()
        print(f"< {greeting}")

Exception : websockets.exceptions.ConnectionClosedError: code = 1009 (message too big), reason = Message too big

Clients eating away the err code :
websocket-client (python)

def withWebSock():
    ws = websocket.WebSocket(sslopt={"cert_reqs": ssl.CERT_NONE})
    ws = create_connection(&#39;wss://<api>.execute-api.us-west-2.amazonaws.com/<stage>&#39;,
                           sslopt={"cert_reqs": ssl.CERT_NONE})
    ws.send("<some large msg>")
    print(ws.recv()) 

Exception : websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed. No err code as such

wscat :

wscat -c wss://<api>.execute-api.us-west-2.amazonaws.com/<stage>/ -w 5 -x <some large msg>

Silently exits

AWS
已回答 4 年前
0

.

已回答 4 年前
0

API Gateway responds back with error code 1009 when it receives a larger frame or message as mentioned here - https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html.

I don't understand what you mean by "the response doesn't go through"? Do you mean the request doesn't go through to your lambda integration? What logs do you see for your API when you send a large message?

已回答 4 年前
0

That may be what the documentation says, but from what we've seen in our use, that is not the case and it doesn't reply at all (as mentioned in the original post)

dave-nm
已回答 4 年前
0

Agreed on the size limit. The websocket limit is 128k while the gateway HTTP limit is 10MB? I can imagine developers walking away from websockets over this limit alone.

My websocket will require my clients to implement multi-page request logic, as a very small percentage of requests will go over 128k.

已回答 4 年前
0

If AWS increased the WebSocket frame size for just the initial frame it would make a huge difference.

That way the 1st frame could contain a large request from the client, with the response(s) going back as the request was processed.

已回答 3 年前
0

The frame limit size of 32KB is unreasonably low and makes writing ANYTHING except a simple text chat application nearly impossible. I don't understand how this is justifiable given that AWS lambda has a payload size of 256KB, eight TIMES the size.

We are seriously considering dropping API gateway completely if this isn't resolved soon.

已回答 3 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则