Search code examples
amazon-web-servicesaws-api-gateway

Is the connection id in apigateway websocket unique?


I am using AWS websocket api gateway and I can get a connection id from the request context. The connection id is a websocket id which I need to save in our database for connection management.

What I am not sure is whether the connection id is unique? Is it possible to get a duplicate connection id when my application is running for a few years?


Solution

  • yes the connectionId value provided in the context object is unique,

    from the docs

    API Gateway WebSocket API mapping template reference

    $context.connectionId -> A unique ID for the connection that can be used to make a callback to the client.