300:) and physical transport layers supporting such stream-based semantics (such as files, sockets or SSL libraries). Connection between a logical protocol and a transport layer happens at the last possible moment — just before information is passed into the logical protocol instance. The logical protocol is informed of the transport layer instance, and can use it to send messages back and to check for the peer's identity. Note that it is still possible, in protocol code, to deeply query the transport layer on transport issues (such as checking a client-side SSL certificate). Naturally, such protocol code will fail (
634:
322:). A deferred is an instance of a class designed to receive and process a result which has not been computed yet, for example because it is based on data from a remote peer. Deferreds can be passed around, just like regular objects, but cannot be asked for their value. Each deferred supports a callback chain. When the deferred gets the value, it is passed to the functions on the callback chain, with the result of each callback becoming the input for the next. Deferreds make it possible to operate on the result of a function call before its value has become available.
1031:
194:
131:
87:
27:
385:
329:
in quad format, a callback can be attached to translate it into a 32-bit number. Any user of the deferred can now treat it as a deferred returning a 32-bit number. This, and the related ability to define "errbacks" (callbacks which are called as error handlers), allows code to specify in advance what
342:
Twisted supports an abstraction over raw threads — using a thread as a deferred source. Thus, a deferred is returned immediately, which will receive a value when the thread finishes. Callbacks can be attached which will run in the main thread, thus alleviating the need for complex locking solutions.
343:
A prime example of such usage, which comes from
Twisted's support libraries, is using this model to call into databases. The database call itself happens on a foreign thread, but the analysis of the result happens in the main thread.
371:(GUI) programs, using all of its libraries without adding a thread-per-socket overhead, as using Python's native library would. A full-fledged web server can be integrated in-process with a GUI program using this model, for example.
1061:
1066:
1051:
252:
1071:
1046:
296:
Twisted is designed for complete separation between logical protocols (usually relying on stream-based connection semantics, such as HTTP or
757:
639:
618:
402:
424:
260:
330:
to do when an asynchronous event occurs, without stopping to wait for the event. In non-event-driven systems, for example using
467:
406:
256:
1056:
228:
217:
144:
210:
159:
110:
683:
334:, the operating system incurs premature and additional overhead organizing threads each time a blocking call is made.
280:
78:
786:
368:
276:
236:
207:
156:
814:
710:
657:
533:
395:
272:
232:
318:
614:
511:, an online cloud data-store, uses Twisted extensively for internal RPC (partly in combination with
588:
151:
193:
86:
765:
735:
647:
331:
301:
244:
213:
844:
604:
512:
688:
667:
561:
463:
166:
567:
Velocity
Weather, a meteorological data processing and integration API is built on Twisted.
548:, a cloud-server management web-application, used Twisted. It now has been rewritten using
652:
39:
130:
26:
1030:
579:, a network management platform, uses Twisted for many internal and collection daemons.
356:
1040:
1001:
938:
679:
495:
445:
264:
240:
481:
one-on-one chat service until it was replaced with gevent for performance reasons.
576:
491:
459:
442:
continuous-integration system relies on
Twisted for client/server communication.
384:
360:
221:
171:
629:
608:
598:
595:
audio-visualizer, uses
Twisted to broadcast real-time edit events to browsers.
539:
523:
474:, has a web-based interface, SageMath notebook, that runs on a Twisted server.
449:
326:
46:
34:
325:
For example, if a deferred returns a string from a remote peer containing an
918:
A WebSocket-oriented monitor for
Knowledge (also, wikimon, wikital monsters)
592:
545:
508:
962:
803:
455:
439:
484:
The Apple
Calendar Server uses Twisted, as do some internal projects of
673:
570:
549:
529:
409: in this section. Unsourced material may be challenged and removed.
916:
582:
555:
478:
471:
364:
119:
1002:"Integrating with other Frameworks — Kivy 1.11.0.dev0 documentation"
352:
898:
502:
862:
501:
The original version of social networking and microblogging site
351:
Twisted can integrate with foreign event loops, such as those of
1024:
661:
516:
485:
297:
248:
182:
980:
826:
378:
268:
564:, a video game broadcasting and chat community, uses Twisted.
312:
Central to the
Twisted application model is the concept of a
880:
691:, a multi-platform GUI framework (including iOS and Android)
304:) if the transport layer does not support such semantics.
542:, an open-source whistleblowing framework, uses Twisted.
279:
paradigm, which means that users of
Twisted write short
601:, a distributed data store and distributed file system.
275:, and others), and much more. Twisted is based on the
367:). This allows using Twisted as the network layer in
519:), for its internal services, and for external APIs.
177:
165:
150:
140:
109:
77:
55:
45:
33:
448:has developed an airline-reservation system for
8:
19:
558:, a cloud telephony provider, uses Twisted.
1029:
192:
129:
85:
18:
16:Event-driven network programming framework
425:Learn how and when to remove this message
1062:Python (programming language) libraries
701:
573:, a web-based IRC client, uses Twisted.
1067:Python (programming language) software
709:Shtull-Trauring, Itamar (2002-10-22).
292:Separation of protocols and transports
7:
640:Free and open-source software portal
617:, a secure file transfer tool using
407:adding citations to reliable sources
670:, for the Java programming language
283:which are called by the framework.
227:Twisted projects variously support
1052:Free software programmed in Python
682:, an event-processing library for
14:
660:, a comparable framework for the
585:, a web crawler based on Twisted.
632:
458:, an open-source alternative to
383:
25:
394:needs additional citations for
1072:Software using the MIT license
863:"Calendar and Contacts Server"
787:"Python Slithers into Systems"
452:that uses Twisted extensively.
1:
1047:Free network-related software
247:, many protocols (including
939:"Deluge: build from source"
494:, an implementation of the
1088:
375:Applications using Twisted
522:The file-hosting service
105:
73:
24:
534:Tor Hidden Services (HS)
477:Twisted was used in the
369:graphical user interface
277:event-driven programming
903:www.velocityweather.com
658:Perl Object Environment
220:and licensed under the
943:dev.deluge-torrent.org
867:www.calendarserver.org
61:; 21 years ago
921:, hatnote, 2017-09-03
815:Sage a Basic Overview
611:client, uses Twisted.
92:; 47 days ago
59:October 22, 2002
1057:Free system software
899:"Velocity Weather -"
831:omegler.blogspot.com
664:programming language
532:, an HTTP proxy for
403:improve this article
347:Foreign loop support
316:(elsewhere called a
607:, a highly modular
589:Listen to Knowledge
211:network programming
21:
648:Application server
302:raise an exception
35:Original author(s)
849:groups.google.com
804:SageMath#Features
758:"BuildBot Manual"
435:
434:
427:
201:
200:
1079:
1033:
1028:
1027:
1025:Official website
1010:
1009:
998:
992:
991:
989:
987:
977:
971:
970:
963:"Magic Wormhole"
959:
953:
952:
950:
949:
935:
929:
928:
927:
926:
913:
907:
906:
895:
889:
888:
877:
871:
870:
859:
853:
852:
841:
835:
834:
823:
817:
812:
806:
801:
795:
794:
783:
777:
776:
774:
773:
764:. Archived from
754:
748:
747:
745:
743:
738:. 10 August 2024
736:"Release 24.7.0"
732:
726:
725:
723:
722:
706:
689:Kivy (framework)
676:, for Javascript
642:
637:
636:
635:
430:
423:
419:
416:
410:
387:
379:
197:
196:
189:
186:
184:
133:
128:
125:
123:
121:
100:
98:
93:
90:/ 10 August 2024
89:
69:
67:
62:
29:
22:
1087:
1086:
1082:
1081:
1080:
1078:
1077:
1076:
1037:
1036:
1023:
1022:
1019:
1014:
1013:
1000:
999:
995:
985:
983:
979:
978:
974:
961:
960:
956:
947:
945:
937:
936:
932:
924:
922:
915:
914:
910:
897:
896:
892:
881:"Twitch - Jobs"
879:
878:
874:
861:
860:
856:
845:"Google Groups"
843:
842:
838:
827:"mistah deejay"
825:
824:
820:
813:
809:
802:
798:
785:
784:
780:
771:
769:
756:
755:
751:
741:
739:
734:
733:
729:
720:
718:
708:
707:
703:
698:
653:Reactor pattern
638:
633:
631:
628:
536:, uses Twisted.
431:
420:
414:
411:
400:
388:
377:
349:
340:
310:
294:
289:
191:
181:
136:
118:
101:
96:
94:
91:
65:
63:
60:
56:Initial release
40:Glyph Lefkowitz
17:
12:
11:
5:
1085:
1083:
1075:
1074:
1069:
1064:
1059:
1054:
1049:
1039:
1038:
1035:
1034:
1018:
1017:External links
1015:
1012:
1011:
993:
981:"EventMachine"
972:
954:
930:
908:
890:
872:
854:
836:
818:
807:
796:
778:
749:
727:
717:(Mailing list)
715:twisted-python
700:
699:
697:
694:
693:
692:
686:
677:
671:
665:
655:
650:
644:
643:
627:
624:
623:
622:
615:Magic Wormhole
612:
602:
596:
586:
580:
574:
568:
565:
559:
553:
543:
537:
527:
520:
506:
499:
498:(SSH) protocol
489:
482:
475:
453:
443:
433:
432:
391:
389:
382:
376:
373:
348:
345:
339:
338:Thread support
336:
309:
306:
293:
290:
288:
285:
243:, Unix domain
199:
198:
185:.twistedmatrix
179:
175:
174:
169:
163:
162:
154:
148:
147:
142:
138:
137:
135:
134:
115:
113:
107:
106:
103:
102:
97:10 August 2024
83:
81:
79:Stable release
75:
74:
71:
70:
57:
53:
52:
49:
43:
42:
37:
31:
30:
15:
13:
10:
9:
6:
4:
3:
2:
1084:
1073:
1070:
1068:
1065:
1063:
1060:
1058:
1055:
1053:
1050:
1048:
1045:
1044:
1042:
1032:
1026:
1021:
1020:
1016:
1007:
1003:
997:
994:
982:
976:
973:
968:
964:
958:
955:
944:
940:
934:
931:
920:
919:
912:
909:
904:
900:
894:
891:
886:
882:
876:
873:
868:
864:
858:
855:
850:
846:
840:
837:
832:
828:
822:
819:
816:
811:
808:
805:
800:
797:
792:
788:
782:
779:
768:on 2012-07-29
767:
763:
759:
753:
750:
737:
731:
728:
716:
712:
711:"Twisted 1.0"
705:
702:
695:
690:
687:
685:
681:
678:
675:
672:
669:
666:
663:
659:
656:
654:
651:
649:
646:
645:
641:
630:
625:
620:
616:
613:
610:
606:
603:
600:
597:
594:
590:
587:
584:
581:
578:
575:
572:
569:
566:
563:
560:
557:
554:
551:
547:
544:
541:
538:
535:
531:
528:
526:used Twisted.
525:
521:
518:
514:
510:
507:
505:used Twisted.
504:
500:
497:
493:
490:
487:
483:
480:
476:
473:
469:
465:
461:
457:
454:
451:
447:
444:
441:
437:
436:
429:
426:
418:
408:
404:
398:
397:
392:This section
390:
386:
381:
380:
374:
372:
370:
366:
362:
358:
354:
346:
344:
337:
335:
333:
328:
323:
321:
320:
315:
307:
305:
303:
299:
291:
286:
284:
282:
278:
274:
270:
266:
262:
258:
254:
250:
246:
242:
238:
234:
230:
225:
223:
219:
215:
212:
209:
205:
195:
188:
180:
176:
173:
170:
168:
164:
161:
158:
155:
153:
149:
146:
143:
139:
132:
127:
117:
116:
114:
112:
108:
104:
88:
82:
80:
76:
72:
58:
54:
50:
48:
44:
41:
38:
36:
32:
28:
23:
1005:
996:
984:. Retrieved
975:
966:
957:
946:. Retrieved
942:
933:
923:, retrieved
917:
911:
902:
893:
884:
875:
866:
857:
848:
839:
830:
821:
810:
799:
790:
781:
770:. Retrieved
766:the original
761:
752:
740:. Retrieved
730:
719:. Retrieved
714:
704:
680:EventMachine
496:Secure Shell
446:ITA Software
421:
412:
401:Please help
396:verification
393:
350:
341:
324:
317:
313:
311:
295:
241:IP multicast
226:
208:event-driven
203:
202:
157:Event-driven
84:24.7.0
47:Developer(s)
577:Zenoss Core
460:Mathematica
222:MIT License
216:written in
172:MIT License
1041:Categories
967:github.com
948:2020-01-08
925:2017-09-21
772:2017-10-28
762:github.com
721:2008-08-14
696:References
609:BitTorrent
599:Tahoe-LAFS
540:GlobaLeaks
524:Ubuntu One
450:Air Canada
415:March 2017
327:IP address
287:Core ideas
160:networking
141:Written in
111:Repository
66:2002-10-22
986:20 August
791:eweek.com
742:27 August
593:Knowledge
546:Cloudkick
509:Fluidinfo
363:(through
308:Deferreds
281:callbacks
214:framework
51:Community
1006:kivy.org
626:See also
456:SageMath
440:BuildBot
314:deferred
126:/twisted
124:/twisted
674:Node.js
571:qwebirc
550:Node.js
530:Tor2web
332:threads
245:sockets
237:SSL/TLS
204:Twisted
178:Website
167:License
95: (
64: (
20:Twisted
885:Twitch
605:Deluge
583:Scrapy
562:Twitch
556:Twilio
513:Thrift
479:Omegle
472:MATLAB
365:PyObjC
319:future
218:Python
206:is an
190:
145:Python
120:github
668:Netty
503:Jaiku
492:Conch
468:Magma
464:Maple
361:Cocoa
988:2011
744:2024
684:Ruby
662:Perl
619:PAKE
591:, a
517:AMQP
515:and
486:NASA
438:The
359:and
353:GTK+
298:POP3
261:IMAP
257:NNTP
253:XMPP
249:HTTP
187:.com
152:Type
122:.com
405:by
273:FTP
269:IRC
265:SSH
233:UDP
229:TCP
183:www
1043::
1004:.
965:.
941:.
901:.
883:.
865:.
847:.
829:.
789:.
760:.
713:.
470:,
466:,
462:,
357:Qt
355:,
271:,
267:,
263:,
259:,
255:,
251:,
239:,
235:,
231:,
224:.
1008:.
990:.
969:.
951:.
905:.
887:.
869:.
851:.
833:.
793:.
775:.
746:.
724:.
621:.
552:.
488:.
428:)
422:(
417:)
413:(
399:.
99:)
68:)
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.