# Reference Websocket Api url in serverless.yml

**URL:** <https://forum.serverless.com/t/reference-websocket-api-url-in-serverless-yml/7829>\
**Category:** Serverless Framework\
**Tags:** aws, api-gateway\
**Created:** [March 28, 2019, 11:45am UTC](https://forum.serverless.com/t/reference-websocket-api-url-in-serverless-yml/7829 "2019-03-28T11:45:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![majindageta](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/majindageta/32/3200_2.png) [@majindageta](https://forum.serverless.com/u/majindageta)\
**Post date:** [March 28, 2019, 11:45am UTC](https://forum.serverless.com/t/reference-websocket-api-url-in-serverless-yml/7829/1 "2019-03-28T11:45:00Z")

</div>

Hello,  
i’m trying to reference the api url of a websocket api.  
I managed to get the reference of a api-gateway via Ref: “ApiGatewayRestApi”

I’m trying now to figure out the same method for a websocket api:

```
functions:
    apiWebsocket:
        handler: index.handler
        environment:
            WS_ENDPOINT: {Ref: "???????"}
        package:
        include:
            - src/**/*
        events:
        - websocket: $connect
        - websocket: $disconnect
        - websocket: $default

```

how can i do this?

there is something similar to how I did for the sqs queue?

```
sqsTest:
    handler: sqs/index.handler
    package:
    include:
        - sqs/**/*
    events:
    - sqs:
        arn:
            Fn::GetAtt:
            - sqsQueue
            - Arn

```

thank you very much

---

<div class="post-metadata">

**Author:** ![moro](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/moro/32/4303_2.png) [@moro](https://forum.serverless.com/u/moro)\
**Post date:** [April 4, 2019, 4:21pm UTC](https://forum.serverless.com/t/reference-websocket-api-url-in-serverless-yml/7829/2 "2019-04-04T16:21:29Z")

</div>

Hi, have you tried to use `WebsocketsApi` ?

> <https://github.com/serverless/serverless/blob/11ff95912921eb3a8431ad576c5fd4499e520f83/lib/plugins/aws/lib/naming.js#L172>

> <https://github.com/serverless/serverless/blob/0968f12e89c699657f079d1aecb69612d0ac9dd5/lib/plugins/aws/package/compile/events/websockets/lib/deployment.test.js#L63>

---

<div class="post-metadata">

**Author:** ![majindageta](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/majindageta/32/3200_2.png) [@majindageta](https://forum.serverless.com/u/majindageta)\
**Post date:** [April 8, 2019, 8:49am UTC](https://forum.serverless.com/t/reference-websocket-api-url-in-serverless-yml/7829/3 "2019-04-08T08:49:31Z")

</div>

> [@moro](#):
>
> - Value: {
> - ‘Fn::Join’: [
> - ‘’,
> - [
> - ‘wss://’,
> - {
> - Ref: ‘WebsocketsApi’,
> - },
> - ‘.execute-api.us-east-1.’,
> - {

Thank you very much, this is exactly what i needed!
