I don't know how to make all these connections by using the connection object. Can anyone give me a hint?
Simultaneous connections
Moderator: leecollings
-
meyland
- Posts: 35
- Joined: Wednesday 03 January 2018 16:39
- Target OS: Linux
- Domoticz version: 2020.2
- Location: Denmark
- Contact:
Simultaneous connections
I'm developing a plugin and I need to be able to make about 20-30 simultaneous connections to a website.
I don't know how to make all these connections by using the connection object. Can anyone give me a hint?
I don't know how to make all these connections by using the connection object. Can anyone give me a hint?
regards
Peter
Peter
Re: Simultaneous connections
You should check the plugins/examples/HTTP.pymeyland wrote: Monday 04 January 2021 20:17 I'm developing a plugin and I need to be able to make about 20-30 simultaneous connections to a website.
I don't know how to make all these connections by using the connection object. Can anyone give me a hint?![]()
And you do as many as you need.self.httpConn = Domoticz.Connection(Name=self.sProtocol+" Test", Transport="TCP/IP", Protocol=self.sProtocol, Address=Parameters["Address"], Port=Parameters["Mode1"])
Now if you don't want to use the Connection API you might go for a multi Thread opening their own connection via urlibrequest or other python3 module like that
- waltervl
- Posts: 6685
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2025.1
- Location: NL
- Contact:
Re: Simultaneous connections
There is a Multi-Thread example https://github.com/domoticz/domoticz/bl ... hreaded.py
See also the Wiki for some remarks about this: https://www.domoticz.com/wiki/Developin ... rk_details:
See also the Wiki for some remarks about this: https://www.domoticz.com/wiki/Developin ... rk_details:
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
meyland
- Posts: 35
- Joined: Wednesday 03 January 2018 16:39
- Target OS: Linux
- Domoticz version: 2020.2
- Location: Denmark
- Contact:
Re: Simultaneous connections
a thought: is it possible to use the asyncio module, ie async and await syntax in a plugin?
regards
Peter
Peter
Re: Simultaneous connections
yes you can use the async
-
meyland
- Posts: 35
- Joined: Wednesday 03 January 2018 16:39
- Target OS: Linux
- Domoticz version: 2020.2
- Location: Denmark
- Contact:
Re: Simultaneous connections
Sounds good. Are there any examples on how to use asyncio?
regards
Peter
Peter
Who is online
Users browsing this forum: Jujutasvu and 1 guest