Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mojoliciousで書いて理解するhotwireの仕組み

mackee
February 19, 2021

 Mojoliciousで書いて理解するhotwireの仕組み

Japan.pm 2021 LT

mackee

February 19, 2021
Tweet

More Decks by mackee

Other Decks in Programming

Transcript

  1. turbo3ܑఋ • turbo drive: ௨ৗͷϦϯΫʹΑΔϖʔδભҠΛ׬શͳϖʔδϩʔσΟ ϯάΛߦΘͣʹϖʔδΛॻ͖׵͑Δ turbolinksͷࠓͷ࢟ • turbo frames:

    ಛఆͷλά಺͚ͩΛ஗ԆͰॻ͖׵͑Δ • turbo streams: αʔόαΠυ͔ΒඈΜͰ͖ͨHTMLΛϖʔδ಺ʹૠೖ ͨ͠Γஔ͖׵͑Δ
  2. ผʹWebSocket͡Όͳͯ͘΋ྑͦ͞͏ • server pushෆཁͰ͋Ε͹ϨεϙϯεͰฦͤ͹OK • ͦ΋ͦ΋WebSocketΛ͠Ό΂ΔͷɺPerlͩͱͭΒ͍ΑͶ • C10Kతͳ໰୊΍ίωΫγϣϯ੾அ໰୊ͱ͔ • ϨϯαόͰͲ͏͢Δͷͱ͔

    CGIͰ΋͜͏͍͏ͷ΋΍Γ͍ͨͰ͢ΑͶ • EventStream͕࣮૷͍ͯ͠Δϝιου͕ੜ͑ͯΔ΍ͭͳΒԿͰ΋৯͑Δ ͷͰϙʔϦϯάͰΤϛϡϨʔγϣϯͨ͠΍ͭ࡞Ε͹ྑͦ͞͏
  3. ·ͱΊ • JavaScriptॻ͔ͳͯ͘΋݁ߏ͍ΖΜͳࣄ͕Ͱ͖Δͧʂʂʂʂ • ΂ΜΓ • hotwire/turbo͸Ruby on Railsઐ༻඼͔ͱࢥͬͨΒͦ͏Ͱ͸ͳ͔ͬͨ •

    ͔͠͠turbo-rails gemͱ͔͋ͬͯศརͦ͏ • LaravelͰ΋ϥΠϒϥϦ͋ΔΒ͍ͧͬͯ͠࿩Λฉ͍ͨ • Ͱ΋HTMLు͚ͨΒ୭Ͱ΋Ͱ͖Δ