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

Make it happen in realtime with Laravel Echo an...

arm4
May 08, 2019

Make it happen in realtime with Laravel Echo and Pusher

arm4

May 08, 2019
Tweet

More Decks by arm4

Other Decks in Programming

Transcript

  1. )/# 2(.5 u Google"'! *- 7+  u  ,1

    u 964$  80 u %&#3 
  2.    u Polling? u Long polling? u Server

    Sent Events? u Websocket?    
  3. Polling l " u -=8@*< u A (,  654'

     l  " u "#/ > u +0:32 u 9? !%1 8; ) u &:$7.
  4. Long polling l "$ u Polling 8$%!1) u /?8B,; 

     l "$ u  *+<234 u  9A) u >-C.)('60 @ u HTTP #&=5 u  9A 7:   
  5. Server Sent Events l   u Web>37: u Long

    Polling 9<-1  u !,$ u <-1 #) 0<- u (?6A&;  l   u 8@$ u IE EdgeSSE %5  Polyfill4* u '.HTTP "=2+/
  6. Websocket l (+ u D7%-, "#&.0 u H2<4; +,'90 u

    4;A u 6G7*$*+#-. ! E6 l (+ u Websocket4;7!?8 u IE10FC1@  u 4;>3 *$,= u /5 ).>3 B: 
  7. ,2 n ' #!".& + n :-?=;>   n

     4< $  9)057 % n 86 /($   1( 30* 
  8. BA 1. PUSHER2%<7 2. LaravelBroadcastServiceProvider>?  3. .envBROADCAST_DRIVERpusher95 PUSHER_APP_ID85 

    4. composerpusher-php-serverinstall  5. Artisan+2&*2%<7  6. *2%. 2") ShouldBroadcast 7. broadcastOn,!$&#-2'0#-2'0:85 8. 2%1. *2%34  9. )12%=($laravel-echo pusher-jsinstall  10. resources/assets/js/bootstrap.jsEcho6;@2,2%  11. /$ 2 #-2'0:*2%. :js;@
  9.  ED 1. !*Redis5#'2 2. redis-server&.5>9  3. RedisPHP+%"composer5#'2 4.

    laravel-echo-servernpm4*25#'2 5. ,4"'&3'1laravel-echo-server init -5(F 6. A= C 7. laravel-echo-server&.5>9  8. .envbroadcast(0*redis  9. Socket.IO5#'2  10. resources/assets/js/bootstrap.jsEcho7<BSocket.IO7  11. EventClass:6 $/5)2;redis$/5)2;@8?
  10. 06%#& n *+ &"$2) / n >1CA?B   n

    !8@ '  =-49; ( n <:!3,'   5, 74. 
  11. Firebase Cloud Messaging(FCM) u Service worker Push   Web

    → https://firebase.google.com/docs/cloud- messaging
  12. -0.$5:%'(.@  <B-0.$ H;5:%'(."#'+)JA  I 5:%'(."#'+)"2&*!  "/"2&*!7 4K

    EC5:,1>G8=   36F9 D?   https://goo.gl/forms/ICdr6QwE2mAjy7oM2