API Gateway Disconnect Client from Server

0

Hello, I'm using the new websocket api and I want to manually disconnect a client from the server. According to https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-how-to-call-websocket-api-connections.html you can disconnect a client by using the @connections route. I don't see any example of how to do that though. Is that undocumented? Thanks!

Your backend service can use the following WebSocket connection HTTP requests to send a callback message to a connected client, get connection information, or disconnect the client.
CP
preguntada hace 5 años980 visualizaciones
1 Respuesta
1

The documentation online doesn't have it yet, however I just skimmed through an AWS video on websockets and I found the answer! You can watch it here: https://youtu.be/3SCdzzD0PdQ?t=718 but I'll outline it below:

https://${Api}.execute-api.${AWS::Region}.amazonaws.com/${Stage}/@connections/${id}

Operation   Action
POST        Sends a message 
GET         Gets the latest connection status
DELETE      Disconnects the connection
CP
respondido hace 5 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