IRC HTTP Stream in YAPC::Asia 2009

2,305 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,305
On SlideShare
0
From Embeds
0
Number of Embeds
475
Actions
Shares
0
Downloads
5
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

IRC HTTP Stream in YAPC::Asia 2009

  1. 1. IRC HTTP Stream yusukebe YAPC::Asia 2009
  2. 2. Want to see talks of the IRC! • But… • IRC port is not available here >< • Port forwarding ? • (既存の) Web proxy ? • Polling ?
  3. 3. No.
  4. 4. We are miyagawanized!
  5. 5. それPla ( SOREPLA )
  6. 6. use Plack with AnyEvent! Plack Async AnyEvent:: IRC IRC::Client HTTP
  7. 7. use Plack::Loader; use AnyEvent; use AnyEvent::IRC::Client; my $impl = Plack::Loader->load( 'AnyEvent', port => 8080 ); my $cv = AnyEvent->condvar; my $pc = AnyEvent::IRC::Client->new;
  8. 8. # Set and Start IRC Client! $cv->begin; $pc->reg_cb( irc_privmsg => sub { my ( $name, $msg ) = @_; $writer->write( $msg->{params}->[1] ); } ); $pc->send_srv( "JOIN", 'yapc.asia-ja' ); $pc->connect( "irc.freenode.net", 6667, { nick => 'nick', user => 'nick', real => 'nick' } ); $cv->end;
  9. 9. # Run plack server $impl->run( sub { my ( $env, $start_response ) = @_; $writer = $start_response->( 200, [ 'Content-Type' => 'text/plain' ] ); $writer->write("IRC HTTP Stream!n"); return []; } ); $impl->run_loop;
  10. 10. DEMO
  11. 11. Test server is available(?) $ curl http://yapc-stream.pulpsite.net
  12. 12. What does ‘それPla’ mean?
  13. 13. If you wan to… • Make original Web Application Framework. • Make Async Web Server. • etc.
  14. 14. Ask miyagawa-san “Do you know a good module?”
  15. 15. Maybe, miyagawa-san says… Plack Author
  16. 16. “Yes. Plack can.”
  17. 17. 「それPlackで  できるよ」
  18. 18. それPla ( SOREPLA )
  19. 19. それPlack でできるよ Plack HACKS
  20. 20. Special thanks to Tatsuhiko Miyagawa –san.

×