Advertisement
Advertisement

More Related Content

Advertisement
Advertisement

IRC HTTP Stream in YAPC::Asia 2009

  1. IRC HTTP Stream yusukebe YAPC::Asia 2009
  2. Want to see talks of the IRC! • But… • IRC port is not available here >< • Port forwarding ? • (既存の) Web proxy ? • Polling ?
  3. No.
  4. We are miyagawanized!
  5. それPla ( SOREPLA )
  6. use Plack with AnyEvent! Plack Async AnyEvent:: IRC IRC::Client HTTP
  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. # 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. # 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. DEMO
  11. Test server is available(?) $ curl http://yapc-stream.pulpsite.net
  12. What does ‘それPla’ mean?
  13. If you wan to… • Make original Web Application Framework. • Make Async Web Server. • etc.
  14. Ask miyagawa-san “Do you know a good module?”
  15. Maybe, miyagawa-san says… Plack Author
  16. “Yes. Plack can.”
  17. 「それPlackで  できるよ」
  18. それPla ( SOREPLA )
  19. それPlack でできるよ Plack HACKS
  20. Special thanks to Tatsuhiko Miyagawa –san.
Advertisement