# Connection refused (websocket, http)

**URL:** <https://forum.inductiveautomation.com/t/connection-refused-websocket-http/70975>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [March 13, 2023, 5:43pm UTC](https://forum.inductiveautomation.com/t/connection-refused-websocket-http/70975 "2023-03-13T17:43:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hamza\_Salah](https://avatars.discourse-cdn.com/v4/letter/h/919ad9/32.png) [@Hamza\_Salah](https://forum.inductiveautomation.com/u/Hamza_Salah)\
**Post date:** [March 13, 2023, 5:43pm UTC](https://forum.inductiveautomation.com/t/connection-refused-websocket-http/70975/1 "2023-03-13T17:43:12Z")

</div>

Hi,  
I'm having a problem establishing a websocket or even an http connection between ignition and my raspberry pi.  
I keep getting this msg: Caused by: org.python.core.PyException: IOError: [Errno socket error] [Errno 10061] Connection refused  
It worked like 2 days ago but for some reason it stopped after changing a few unrelated things in the project, now all I get is connection refused.  
my http comm code:

 ![http](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/2/d23ec4aca3e22658d7155ada2c63d67185e93f18.png)

my websocket code:

 ![websocket](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/a/aa50dcf0f0c4d91df26f424973dd1f2c19bfab22.png)

please let me know if you need more info

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 13, 2023, 7:07pm UTC](https://forum.inductiveautomation.com/t/connection-refused-websocket-http/70975/2 "2023-03-13T19:07:25Z")

</div>

> [@Hamza\_Salah](#):
>
> all I get is connection refused

That is purely a network error. Something isn't listening on the expected port, or expected address, or is blocked by a firewall along the way.

---

<div class="post-metadata">

**Author:** ![Hamza\_Salah](https://avatars.discourse-cdn.com/v4/letter/h/919ad9/32.png) [@Hamza\_Salah](https://forum.inductiveautomation.com/u/Hamza_Salah)\
**Post date:** [March 13, 2023, 7:22pm UTC](https://forum.inductiveautomation.com/t/connection-refused-websocket-http/70975/3 "2023-03-13T19:22:42Z")

</div>

Thanks for the reply Phil, I have the firewall disabled, and I also tested the code on my raspi with an esp8622.. they both communicate well, so my port/ address are both good I think.  
The ignition was communicating but it stopped after some changes in the project as I mentioned.  
Is there any other tips to troubleshoot this ?

Much appreciated.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 14, 2023, 5:31am UTC](https://forum.inductiveautomation.com/t/connection-refused-websocket-http/70975/4 "2023-03-14T05:31:22Z")

</div>

> [@Hamza\_Salah](#):
>
> stopped after some changes in the project

Consider reverting those changes. Or share them with us.

---

<div class="post-metadata">

**Author:** ![Bowsal\_G](https://avatars.discourse-cdn.com/v4/letter/b/90db22/32.png) [@Bowsal\_G](https://forum.inductiveautomation.com/u/Bowsal_G)\
**Post date:** [September 23, 2023, 6:22am UTC](https://forum.inductiveautomation.com/t/connection-refused-websocket-http/70975/5 "2023-09-23T06:22:11Z")

</div>

Hello,  
I am also getting error as "com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 19, in handleMessage File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib\_socket.py", line 1443, in meth return getattr(self.\_sock,name)(\*args) File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib\_socket.py", line 936, in connect self.\_connect(addr) File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib\_socket.py", line 912, in \_connect self.\_handle\_channel\_future(self.connect\_future, "connect") File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib\_socket.py", line 385, in handle\_exception raise \_map\_exception(jlx) \_socket.error: [Errno 10061] Connection refused" Could you help me on this?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 23, 2023, 2:09pm UTC](https://forum.inductiveautomation.com/t/connection-refused-websocket-http/70975/6 "2023-09-23T14:09:24Z")

</div>

> [@Bowsal\_G](#):
>
> Connection refused

The target actively reject your attempt to connect. It isn't a problem on the Ignition side. (Though, you should not be using jython libraries for networking. Use java libraries, or `system.net.httpClient()`. Much more reliable and performant.)
