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!

preguntada hace 4 años2058 visualizaciones
7 Respuestas
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
respondido hace 4 años
0

.

respondido hace 4 años
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?

respondido hace 4 años
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
respondido hace 4 años
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.

respondido hace 4 años
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.

respondido hace 3 años
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.

respondido hace 3 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas