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
已提问 5 年前980 查看次数
1 回答
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
已回答 5 年前

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

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

回答问题的准则