# Error : Websocket connection is failed

**URL:** <https://forum.canton.network/t/error-websocket-connection-is-failed/1758>\
**Category:** App Development\
**Created:** [December 8, 2020, 3:00pm UTC](https://forum.canton.network/t/error-websocket-connection-is-failed/1758 "2020-12-08T15:00:41Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![palanisamyc](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@palanisamyc](https://forum.canton.network/u/palanisamyc)\
**Post date:** [December 8, 2020, 3:00pm UTC](https://forum.canton.network/t/error-websocket-connection-is-failed/1758/1 "2020-12-08T15:00:41Z")

</div>

I am deploying my sample app which is built on top of DAML UI template in the Azure VM (Ubuntu 18.04). I have opened the required ports like 7500, 3000, 6865 and 7575. The application is running successfully on localhost. However, after deployed into the Azure VM getting the “Websocket connection is failed” error. Can someone help me out to move forward on this?

 ![ws error](https://canada1.discourse-cdn.com/flex028/uploads/daml/original/2X/3/330fddfa15ee9570aeee3e79a47bf69477a879fb.png)

@ManishGrover @Levente_Barczy

---

<div class="post-metadata">

**Author:** ![ManishGrover](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/manishgrover/32/63_2.png) [@ManishGrover](https://forum.canton.network/u/ManishGrover)\
**Post date:** [December 8, 2020, 3:01pm UTC](https://forum.canton.network/t/error-websocket-connection-is-failed/1758/2 "2020-12-08T15:01:55Z")

</div>

Is the navigator working?

---

<div class="post-metadata">

**Author:** ![palanisamyc](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@palanisamyc](https://forum.canton.network/u/palanisamyc)\
**Post date:** [December 8, 2020, 3:20pm UTC](https://forum.canton.network/t/error-websocket-connection-is-failed/1758/3 "2020-12-08T15:20:12Z")

</div>

yes @ManishGrover

---

<div class="post-metadata">

**Author:** ![Levente\_Barczy](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/levente_barczy/32/544_2.png) [@Levente\_Barczy](https://forum.canton.network/u/Levente_Barczy)\
**Post date:** [December 8, 2020, 3:30pm UTC](https://forum.canton.network/t/error-websocket-connection-is-failed/1758/4 "2020-12-08T15:30:10Z")

</div>

Hi @palanisamyc ,

Can you describe the architecture a bit more? Are you trying to run the sandbox in an Azure VM?

---

<div class="post-metadata">

**Author:** ![palanisamyc](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@palanisamyc](https://forum.canton.network/u/palanisamyc)\
**Post date:** [December 8, 2020, 3:35pm UTC](https://forum.canton.network/t/error-websocket-connection-is-failed/1758/5 "2020-12-08T15:35:07Z")

</div>

Yes, @Levente_Barczy I have the sandbox/JSON-API running on the same VM. I have updated the /etc/hosts file for the localhost. also i have updated the config.ts with the VM’s public IP. Let me know if you need more information.

---

<div class="post-metadata">

**Author:** ![bernhard](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/bernhard/32/356_2.png) [@bernhard](https://forum.canton.network/u/bernhard)\
**Post date:** [December 8, 2020, 4:25pm UTC](https://forum.canton.network/t/error-websocket-connection-is-failed/1758/6 "2020-12-08T16:25:07Z")

</div>

Can you do a simple curl to the normal non-streaming query endpoint? Does it work through http and/or https? Are you going through any reverse proxies? Is SSL set up?

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [December 8, 2020, 4:28pm UTC](https://forum.canton.network/t/error-websocket-connection-is-failed/1758/7 "2020-12-08T16:28:44Z")

</div>

Looking at the error, it looks like you are using the webpack-dev-server provided by `yarn start/npm start`. Outside of your local machine, I would strongly recommend to avoid webpack-dev-server and instead use Nginx or another reverse proxy to host your static files and proxy the JSON API.

---

<div class="post-metadata">

**Author:** ![palanisamyc](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@palanisamyc](https://forum.canton.network/u/palanisamyc)\
**Post date:** [December 8, 2020, 4:47pm UTC](https://forum.canton.network/t/error-websocket-connection-is-failed/1758/8 "2020-12-08T16:47:16Z")

</div>

Its http. No i am not configured any reverse proxies.

---

<div class="post-metadata">

**Author:** ![Levente\_Barczy](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/levente_barczy/32/544_2.png) [@Levente\_Barczy](https://forum.canton.network/u/Levente_Barczy)\
**Post date:** [December 8, 2020, 5:53pm UTC](https://forum.canton.network/t/error-websocket-connection-is-failed/1758/9 "2020-12-08T17:53:21Z")

</div>

Adding to the questions from Bernhard above, how do you know that the sandbox and the json server are running? (It likely is, just checking).

---

<div class="post-metadata">

**Author:** ![palanisamyc](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@palanisamyc](https://forum.canton.network/u/palanisamyc)\
**Post date:** [December 8, 2020, 6:04pm UTC](https://forum.canton.network/t/error-websocket-connection-is-failed/1758/10 "2020-12-08T18:04:24Z")

</div>

@Levente_Barczy the daml navigator is running without any issues. The issue is only when we try to query the contracts from DAML UI

 ![ws error](https://canada1.discourse-cdn.com/flex028/uploads/daml/original/2X/5/55996ebf17b1fc1f0a6d14f1ff4baeebdce2dc35.png)

---

<div class="post-metadata">

**Author:** ![bernhard](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/bernhard/32/356_2.png) [@bernhard](https://forum.canton.network/u/bernhard)\
**Post date:** [December 8, 2020, 6:15pm UTC](https://forum.canton.network/t/error-websocket-connection-is-failed/1758/11 "2020-12-08T18:15:16Z")

</div>

Ah… The dev server doesn’t by default accept connections from external interfaces and additionally does a host check. You’ll need to set some unsafe flags to use that on Azure…

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [December 8, 2020, 6:17pm UTC](https://forum.canton.network/t/error-websocket-connection-is-failed/1758/12 "2020-12-08T18:17:41Z")

</div>

> [@bernhard](#):
>
> You’ll need to set some unsafe flags to use that on Azure…

As I said before, I highly recommend going down the NGinx route for this. webpack-dev-server is intended for development not for deploying it on external servers.

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [December 8, 2020, 6:22pm UTC](https://forum.canton.network/t/error-websocket-connection-is-failed/1758/13 "2020-12-08T18:22:00Z")

</div>

You can find an Nginx config for proxying the JSON APi and hosting some static files in one of our example projects at [davl/nginx.conf.sh at 91aa619d134d3c1fa893b8d73d21c69ece133233 · digital-asset/davl · GitHub](https://github.com/digital-asset/davl/blob/91aa619d134d3c1fa893b8d73d21c69ece133233/docker/nginx.conf.sh#L13)
