Successfully reported this slideshow.
Your SlideShare is downloading. ×

Broadcast your programming

Loading in …3

Check these out next

1 of 39 Ad

More Related Content

Similar to Broadcast your programming (20)


Broadcast your programming

  1. 1. Broadcast Your Programming Jason May @jasonmay jasonmay [] jasonmay []
  2. 2. Why?
  3. 3. Demonstrations
  4. 4. Explanations
  5. 5. Ostentation
  6. 6. The World of Learning
  7. 7. Streaming
  8. 8.
  9. 9. ttrtail.c
  10. 10. App::Termcast (:
  11. 11. server PTY termcast stdout
  12. 12. App::Termcast::Server
  13. 13. Implementation
  14. 14. Termcast Socket TCP Manager UNIX
  15. 15. Termcast Socket TCP AppX Manager AppY UNIX AppZ
  16. 16. Termcast Socket TCP AppX Manager AppY UNIX AppZ
  17. 17. Termcast Streamer A Socket TCP AppX Manager AppY UNIX AppZ
  18. 18. Termcast Streamer A Socket UNIX TCP AppX Manager Socket A AppY UNIX AppZ
  19. 19. Termcast Streamer A Socket TCP AppX Manager Socket A AppY UNIX UNIX AppZ
  20. 20. Termcast Streamer A Socket “A new streamer connected!” TCP AppX Manager Socket A AppY UNIX UNIX AppZ
  21. 21. Termcast Viewer A Socket TCP AppX Manager Socket A AppY UNIX UNIX AppZ *click*
  22. 22. Termcast Streamer A Socket TCP AppX Manager Socket A AppY UNIX [ANSI] UNIX AppZ
  23. 23. A new streamer connected! Connect to him at /tmp/fooXYZ.sock UNIX
  24. 24. Streamer ABC disconnected. UNIX
  25. 25. Streamer resized his terminal to 160x48! UNIX
  26. 26. Client Side
  27. 27. App::Termcast::Connector
  28. 28. App::Termcast::Connector • Callback Stack • Dispatcher
  29. 29. App::Termcast::Server::Telnet
  30. 30. App::Termcast::Server::Telnet • App::Termcast::Connector • Reflex • Listening telnet socket
  31. 31. App::Termcast::Server::Web
  32. 32. Inspired by HTML::FromANSI
  33. 33. New Hotness • HTML5 Canvas • Web::Hippie • Term::VT102::Incremental
  34. 34. • App::Termcast • App::Termcast::Server • Application Components • Write your own!
  35. 35. Reference • • • • • •

Editor's Notes

  • \n
  • Some of you may be wondering, “Why would you want to broadcast the projects you are working on?”\n
  • The first thing that comes to mind, (I don’t know why), is possibly for a demo, say, for a talk!\n\ncode reviews\n
  • Does something not make sense to you? Let me “show” you!\n
  • You can also broadcast to be ostentatious, or in other words, a showoff. What if you’re 13 years old and you want to show everyone your cool new fancy bash prompt? Gotta broadcast it!\n
  • So, all of these purposes fall under one aspect: education. The Internet, among other things, is used all around the world for education. There are many universities that teach their courses online. You have Webinars, crowd-sourced encyclopedias, and even your home-brewed video tutorials online.\n
  • Streaming over the web is a great way to teach.\n
  • And what if it could be as easy as installing a single module?\n
  • And then as easy as typing a command to start broadcasting?\n
  • \n
  • App::Termcast ->\ntelnet -> view broadcasters\nextremely basic client written in C (required ttyrec)\n
  • the original client is a C file\ncompile by hand with gcc\nrun ttyrec\npoint ttrtail to the ttyrec\n
  • So Jesse Luehrs wrote App::Termcast.\n\nbypasses ttyrec, sends straight to server\n
  • reads pty input\n\nsends to server and stdout\n
  • So we figured, why have something tied to telnet?\n\nHost it anywhere\n\nMore extendible: “brain” for broadcasting terminals\n
  • Let me explain what I mean by “brain”\n
  • You have two sockets:\n termcast\n manager\n
  • The manager socket is for communication between application sockets\nTelnet\nIRC\nWeb\n
  • Let’s say the bottom app is a web app\n\nand someone points their browser to it\n\nnobody is connected\n
  • Streamer A connects to the TCP socket\n\n\n
  • A new listening unix socket is created for the streamer\n
  • A new listening unix socket is created for the streamer\n
  • When server accepts the termcast connection...\n\nThe manager socket tells all the apps that the streamer connected\n
  • Poof! The browser sees a new connection\n\nclicks to start viewing over the web\n
  • logic in the app makes it connect to Socket A (the socket representing Streamer A) to start receiving data.\nIt’s just a raw stream of ANSI\nthen when Streamer B connects, Socket B will be made, and so on.\n
  • When the termcast connection arrives,\nthe manager tells all the apps the represented socket path\nthis is what the apps use when people try to view connections through the app. an ID is also given to each stream.\n
  • connections aren’t the only thing that the manager will message to the apps.\nIt will tell the apps when a streamer disconnects, sending its ID.\n
  • Terminal properties can change mid-stream, such as terminal size. the manager will let apps know this too.\n
  • But what about the client side with regard to the apps?\n
  • I wrote a convenient distribution for having your own app connect to this “brain” of a server.\n
  • lets you register a series of callbacks\n connect / disconnect\n various responses, like getting the current list of termcast sessions\nit is backend-independent. you could use reflex, anyevent, IO::Select, anything you want. jut invoke connector’s dispatch method when you receive socket input, and it triggers all the callbacks for you\n\n
  • One of the apps I am working on for this server, is app-termcast-server-telnet.\n\n\n
  • uses my connector module, reflex, listening telnet socket.\n\nvery straightforward, most complicated part of the code is the telnet interface logic.\n
  • Looks kind of like this.\n
  • I’m also working on a termcast web component. It’s a bit more complicated than the telnet one.\n\n
  • My first prototype used HTML::FromANSI\njust processes ANSI, then it turned it all into a bunch of HTML\nmy web app was just a single raw fcgi app that did a basic GET request every 0.1 seconds or so, and did a simple update on a div.\nvery inefficient\n
  • HTML5 Canvas\nPlack App - mount it yourself\nWeb::Hippie (WebSockets, degrades to MXHR polling, etc.)\nt-vt-i made by yours truly, processes ANSI, returns only parts that changed, convenient for sending as JSON over the web\nyou can find it on my github page\n
  • \n
  • \n