# NATS client cannot connect to polygon

**URL:** <https://forum.alpaca.markets/t/nats-client-cannot-connect-to-polygon/797>\
**Category:** Alpaca Account Troubleshooting\
**Created:** [February 17, 2020, 5:53am UTC](https://forum.alpaca.markets/t/nats-client-cannot-connect-to-polygon/797 "2020-02-17T05:53:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![andyross](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@andyross](https://forum.alpaca.markets/u/andyross)\
**Post date:** [February 17, 2020, 5:53am UTC](https://forum.alpaca.markets/t/nats-client-cannot-connect-to-polygon/797/1 "2020-02-17T05:53:19Z")

</div>

I no longer can use Quantconnect to trade on Alpaca, there is an error connecting to polygon via NATS client. I tried everything I could think of with no luck. It’s the case in both paper and live trading.

I tried writing a basic NATS client and see if I could successfully connect to polygon, and unfortunately it wasn’t the case. Here’s the error my nodejs client produced:

name: ‘NatsError’,  
message: 'Could not connect to server: Error: connect ETIMEDOUT [38.133.177.114:31103]  
code: ‘CONN\_ERR’,  
chainedError: Error: connect ETIMEDOUT [38.133.177.114:31103](http://38.133.177.114:31103)  
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1137:16) {  
errno: -110,  
code: ‘ETIMEDOUT’,  
syscall: ‘connect’,  
address: ‘38.133.177.114’,  
port: 31103  
}  
}

I believe it’s either polygon is blocking my connection or there is some weird reason behind it. I would appreciate any help.

Thanks,  
Andy

---

<div class="post-metadata">

**Author:** ![ZZook2](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/zzook2/32/471_2.png) [@ZZook2](https://forum.alpaca.markets/u/ZZook2)\
**Post date:** [February 19, 2020, 5:49pm UTC](https://forum.alpaca.markets/t/nats-client-cannot-connect-to-polygon/797/2 "2020-02-19T17:49:26Z")

</div>

I cannot connect to their ips either, so I’ve been using polygon rest api and websocket streams instead but I see there is a delay there, the trades showing and quotes are delayed in time…

---

<div class="post-metadata">

**Author:** ![andyross](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@andyross](https://forum.alpaca.markets/u/andyross)\
**Post date:** [February 21, 2020, 3:22am UTC](https://forum.alpaca.markets/t/nats-client-cannot-connect-to-polygon/797/3 "2020-02-21T03:22:10Z")

</div>

Yeah, I found out their support of NATS were deprecated by the beginning of the 2020 ☹  
Now the folks at Quantconnect are gonna try to replace their NATS client with a websocket client

---

<div class="post-metadata">

**Author:** ![ZZook2](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/zzook2/32/471_2.png) [@ZZook2](https://forum.alpaca.markets/u/ZZook2)\
**Post date:** [February 21, 2020, 3:37pm UTC](https://forum.alpaca.markets/t/nats-client-cannot-connect-to-polygon/797/4 "2020-02-21T15:37:00Z")

</div>

You can rewrite the python code to use the socket as well, are you seeing delay on the socket as well?
