[Twisted-Python] txThings - simple library for CoAP protocol
![](https://secure.gravatar.com/avatar/9b74e38cc24a1ca56707272717f736ec.jpg?s=120&d=mm&r=g)
Hello everyone, I would like to announce the first release of txThings. It is a simple library for Constrained Application Protocol (CoAP). CoAP is a relatively new protocol designed for "Internet of Things" and M2M communications. txThings currently implements a subset of CoAP features: - standard messaging based on draft-ietf-core-coap-13 (no proxying support yet) - blockwise transfers based on draft-ietf-core-block-12 - limited suport for RFC6690 Core Link Format (for servers only) I hope to add new features like Observe (draft-ietf-core-observe-09) soon. TxThings is my first Twisted project, so the code quality can probably be improved, also better unit testing is necessary. However I decided to release the code in its current form to discover, if there is any interest in it. Internet of Things is currently very interesting field of development. It is approaching a phase where many opportunities for both large and small players. I think Twisted is well suited for development of IoT apps: - it's stable - it's Python based and portable - it has good support for UDP and TCP, which makes it ideal for proxying IoT protocols to HTTP In my opinion in the next three years, at least 20% of Twisted apps will be IoT related (educated guess, no hard data :) ) There are many new protocols out there designed for IoT, in my opinion CoAP and MQTT have the biggest chance of adoption. CoAP is developed by IETF, and backed by companies like ARM. You can download txThings from Github: https://github.com/siskin/txThings Description: http://sixpinetrees.blogspot.com/2013/09/txthings-good-enough-is-good-enough... Few more remarks: - txThings works on RaspberryPi (tested) - txThings plays well with Kivy Python GUI Library http://kivy.org Kivy is new GUI library that supports Twisted, and allows building apps for Android and iOS - I've ran a few tests, and it's very promising :) Photo: http://bit.ly/1aPZ1ag Best Regards Maciej Wasilak
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
On Sep 20, 2013, at 1:54 AM, Maciej Wasilak <wasilak@gmail.com> wrote:
I would like to announce the first release of txThings. It is a simple library for Constrained Application Protocol (CoAP). CoAP is a relatively new protocol designed for "Internet of Things" and M2M communications.
Thanks for sharing this, Maciej! Please feel free to keep on sending more announcements as you put Twisted inside of more devices ;-). -glyph
![](https://secure.gravatar.com/avatar/83111e3ce141b383d5169be6edd768d1.jpg?s=120&d=mm&r=g)
I would like to announce the first release of txThings. It is a simple library for Constrained Application Protocol (CoAP). CoAP is a relatively new protocol designed for "Internet of Things" and M2M communications.
Cool!
Internet of Things is currently very interesting field of development. It is approaching a phase where many opportunities for both large and small players. I think Twisted is well suited for development of IoT apps: - it's stable - it's Python based and portable - it has good support for UDP and TCP, which makes it ideal for proxying IoT protocols to HTTP In my opinion in the next three years, at least 20% of Twisted apps will be IoT related (educated guess, no hard data :) )
I fully agree that Python/Twisted may have a particular competitive advantage in embedded / IoT (see below). And if so, why not take that opportunity and actively embrace / promote specifically IoT from the Twisted community? Why I think Python/Twisted has an edge: - the (more pure) Web play languages like PHP and Ruby don't fit well with processing serial port data or doing UDP (if possible at all) - Perl - shudder;) Python is easy to approach for beginners and sane and bla bla bla - C: is here to stay, and has it's place in IoT - C++: can't see a particular competitive advantage for IoT - same goes for (great) stuff like Haskell or Erlang Whats your take on the stuff below? There is .NET driven by MS. I wasn't aware that they created a .NET Micro under _Apache 2.0_ (!): http://en.wikipedia.org/wiki/.NET_Micro_Framework http://www.netmf.com/ Then there is Oracle with Java ME http://www.oracle.com/us/solutions/internetofthings/index.html Then there is .. JavaScript. Put v8/node on your Pi. However, Node has quite a different focus. Last time I checked e.g. the support for serial was not in main project (I had read comments they don't _want_ to have it). And then there is the Lua universe that has a bunch of brilliant stuff: http://www.eluaproject.net/ http://luajit.org/ https://github.com/justincormack/ljsyscall === If above sounds OT for this list, in one way probably, but when looking from the angle: competitive advantage of Python/Twisted and opportunities for expanding the community and actively promoting Twisted, I'd say it's on topic. /Tobias
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
On Oct 5, 2013, at 3:12 PM, Tobias Oberstein <tobias.oberstein@tavendo.de> wrote:
If above sounds OT for this list, in one way probably, but when looking from the angle: competitive advantage of Python/Twisted and opportunities for expanding the community and actively promoting Twisted, I'd say it's on topic.
While I appreciate showing respect for the list membership's time and trying to stay on topic - jeez, lighten up, if you have stuff to say about Twisted, please just say it on this list ;-). The Management will not hesitate to (gently, politely) tell you if we believe you've gone too far afield. -glyph
![](https://secure.gravatar.com/avatar/83111e3ce141b383d5169be6edd768d1.jpg?s=120&d=mm&r=g)
If above sounds OT for this list, in one way probably, but when looking from the angle: competitive advantage of Python/Twisted and opportunities for expanding the community and actively promoting Twisted, I'd say it's on topic.
While I appreciate showing respect for the list membership's time and trying to stay on topic - jeez, lighten up, if you have stuff to say about Twisted, please just >say it on this list ;-). The Management will not hesitate to (gently, politely) tell you if we believe you've gone too far afield.
Ok, thank you for making this crystal clear! What's your take on the tactic/proposal "actively promoting Twisted for IoT"? E.g., as a start, we could have a dedicated page on the Twistedmatrix Web site "Twisted for Things" for intro and collecting links, articles etc Dummy question: how would I contribute to the Trac-based Web site content? /Tobias
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
On Oct 6, 2013, at 4:11 AM, Tobias Oberstein <tobias.oberstein@tavendo.de> wrote:
If above sounds OT for this list, in one way probably, but when looking from the angle: competitive advantage of Python/Twisted and opportunities for expanding the community and actively promoting Twisted, I'd say it's on topic.
While I appreciate showing respect for the list membership's time and trying to stay on topic - jeez, lighten up, if you have stuff to say about Twisted, please just >say it on this list ;-). The Management will not hesitate to (gently, politely) tell you if we believe you've gone too far afield.
Ok, thank you for making this crystal clear!
What's your take on the tactic/proposal "actively promoting Twisted for IoT"?
Personally I don't have much of one. I don't know a lot about that space.
E.g., as a start, we could have a dedicated page on the Twistedmatrix Web site "Twisted for Things" for intro and collecting links, articles etc
Fun fact: the very first class in the very first thing that would eventually become Twisted was called "Thing". ;-)
Dummy question: how would I contribute to the Trac-based Web site content?
Just click on the "edit" button at the bottom of any wiki page. Some of the pages (like the front page) are locked to prevent abuse, but I can give you whatever extra permissions you need if you want to work on the site. -glyph
![](https://secure.gravatar.com/avatar/83111e3ce141b383d5169be6edd768d1.jpg?s=120&d=mm&r=g)
E.g., as a start, we could have a dedicated page on the Twistedmatrix Web site "Twisted for Things" for intro and collecting links, articles etc
Fun fact: the very first class in the very first thing that would eventually become Twisted was called "Thing". ;-)
What a prevision;)
Dummy question: how would I contribute to the Trac-based Web site content?
Just click on the "edit" button at the bottom of any wiki page. Some of the pages (like the front page) are locked to prevent abuse, but I can give you whatever extra permissions you need if you want to work on the site.
Yes please, I'd like to contribute to the site. I have visited a dozen pages from the Index, and I have no "edit" button .. nowhere. I am logged in ("oberstet") .. I can file/edit tickets. I would start by creating a new page, following http://twistedmatrix.com/trac/wiki/WikiNewPage, and - at this point - only add a link to the new page from the Index page. A general question regarding using Trac as a Website system: the landing page does only links to a couple of further pages. How are user supposed to navigate around? Always via the Index page? You know, I haven't done a lot systematic looking around exactly for that reason .. when I look for Twisted docs/pages, I basically Google for them (sometimes restricting the search to Twistedmatrix). The UX of the Website is .. unusual .. or I just don't get it. /Tobias
-glyph _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
![](https://secure.gravatar.com/avatar/96be05e48fb75e91cae316ab9589a898.jpg?s=120&d=mm&r=g)
Tobias Oberstein <tobias.oberstein <at> tavendo.de> writes:
E.g., as a start, we could have a dedicated page on the Twistedmatrix Web site "Twisted for Things" for intro and collecting links, articles etc
Fun fact: the very first class in the very first thing that would eventually become Twisted was called "Thing".
What a prevision;)
Dummy question: how would I contribute to the Trac-based Web site content?
Just click on the "edit" button at the bottom of any wiki page. Some of the pages (like the front page) are locked to prevent abuse, but I can give you whatever extra permissions you need if you want to work on the site.
Yes please, I'd like to contribute to the site.
I have visited a dozen pages from the Index, and I have no "edit" button
("oberstet") .. I can file/edit tickets.
I would start by creating a new page, following http://twistedmatrix.com/trac/wiki/WikiNewPage, and - at this point - only add a link to the new page from the Index page.
A general question regarding using Trac as a Website system: the landing
.. nowhere. I am logged in page does only links to a couple of
further pages. How are user supposed to navigate around? Always via the Index page?
You know, I haven't done a lot systematic looking around exactly for that reason .. when I look for Twisted docs/pages, I basically Google for them (sometimes restricting the search to Twistedmatrix). The UX of the Website is .. unusual .. or I just don't get it.
/Tobias
-glyph _______________________________________________ Twisted-Python mailing list Twisted-Python <at> twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Following with interest. Seeking a CoAP Python client capability that includes: - Support for IPV6 to talk directly to server motes in constrained 6LoWPAN WSNs. (the large IPV6 address space is for me intrinsic to the IoT concept) - Security for the same, so presumably DTLS. Both of these needed and particularly security, for any serious monitoring and control applications. Best wishes Ron
![](https://secure.gravatar.com/avatar/9b74e38cc24a1ca56707272717f736ec.jpg?s=120&d=mm&r=g)
Ron, Following with interest. Seeking a CoAP Python client capability that
includes: - Support for IPV6 to talk directly to server motes in constrained 6LoWPAN WSNs. (the large IPV6 address space is for me intrinsic to the IoT concept) - Security for the same, so presumably DTLS. Both of these needed and particularly security, for any serious monitoring and control applications.
IPv6 is my target too. In general I've managed to run some tests with txThings and Contiki powered 6LoWPAN motes. My points below: 1. Twisted doesn't officially support UDP IPv6 yet - however there was great progress lately - see ticket #5086 ( http://twistedmatrix.com/trac/ticket/5086). Someone else should probably comment on that, but it seems to be close to the finish line 2. You can easily add unofficial IPv6 support (basic unicast) by modifying twisted/internet/udp.py. I'll email you the details. 3. There is a problem with txThings IPv6 server, because in most operating systems source address of datagram is determined in round robin fashion. It may cause the source address of the response to be different than destination address of the request. CoAP client drops such responses and sends RST. I haven't solved the problem yet. However if you need only client you should be okay for now. 4. DTLS is currently not supported. I agree it's a must for any real life application. There are some Python DTLS implementations out there, but I haven't tried to use them with Twisted yet. 5. I don't know of any non-Twisted Python CoAP libraries with full IPv6 and DTLS support. This week there was CoAP Plugtest event in Las Vegas (ended yesterday) - when IETF Core working group publishes some report, it might be a good summary of existing CoAP implementations. According to the first summary DTLS plugtest had 66% success rate - which means it's a though topic. Best regards Maciej Wasilak
![](https://secure.gravatar.com/avatar/426d6dbf6554a9b3fca1fd04e6b75f38.jpg?s=120&d=mm&r=g)
On 23/11/13 12:03, Maciej Wasilak wrote:
3. There is a problem with txThings IPv6 server, because in most operating systems source address of datagram is determined in round robin fashion. It may cause the source address of the response to be different than destination address of the request.
This is in general a bit of a pain with UDP apps. In Twisted, the easiest solution is to specifically bind the UDP sockets to the IP address(es) on the host, and always reply on the same protocol/transport you received on. You may find the "netifaces" package helpful for getting a list of IPs in a cross-platform manner. In theory you can avoid doing this if you have sendmsg/recvmsg support, but Twisted doesn't have this (yet).
![](https://secure.gravatar.com/avatar/96be05e48fb75e91cae316ab9589a898.jpg?s=120&d=mm&r=g)
Maciej Wasilak <wasilak <at> gmail.com> writes:
Ron,
Following with interest. Seeking a CoAP Python client capability that
- Support for IPV6 to talk directly to server motes in constrained 6LoWPAN WSNs. (the large IPV6 address space is for me intrinsic to the IoT concept) - Security for the same, so presumably DTLS. Both of these needed and particularly security, for any serious monitoring and control applications.
IPv6 is my target too. In general I've managed to run some tests with txThings and Contiki powered 6LoWPAN motes. My points below:1. Twisted doesn't officially support UDP IPv6 yet - however there was great progress lately - see ticket #5086 (http://twistedmatrix.com/trac/ticket/5086). Someone else should
includes: probably comment on that, but it seems to be close to the finish line
2. You can easily add unofficial IPv6 support (basic unicast) by modifying
twisted/internet/udp.py. I'll email you the details.
3. There is a problem with txThings IPv6 server, because in most operating
systems source address of datagram is determined in round robin fashion. It may cause the source address of the response to be different than destination address of the request. CoAP client drops such responses and sends RST. I haven't solved the problem yet. However if you need only client you should be okay for now.
4. DTLS is currently not supported. I agree it's a must for any real life
application. There are some Python DTLS implementations out there, but I haven't tried to use them with Twisted yet.
5. I don't know of any non-Twisted Python CoAP libraries with full IPv6
and DTLS support. This week there was CoAP Plugtest event in Las Vegas (ended yesterday) - when IETF Core working group publishes some report, it might be a good summary of existing CoAP implementations. According to the first summary DTLS plugtest had 66% success rate - which means it's a though topic.
Best regards
Maciej Wasilak
_______________________________________________ Twisted-Python mailing list Twisted-Python <at> twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Maciej, thank you, very interesting. But I guess not such good news for the serious use of CoAP right now. The percentage 'pass' for interoperability tests of DTLS are perhaps no surprise, as unless a standard is very tight there will be slightly different interpretations. Really appreciate your providing details for getting an IPV6 CoAP client working with Twisted. Best wishes Ron
participants (5)
-
Glyph
-
Maciej Wasilak
-
Phil Mayers
-
Ron Segal
-
Tobias Oberstein