ããªãã«ããããããWebSocketãç¨ããå ¨ãæ°ããOAuthã®ãç´¹ä»
ãã®è¨äºã¯ã Advent Calendar 2016 - VOYAGE GROUP techlog ã®16æ¥ç®ã®ã¨ã³ããªã§ãï¼
ã¿ãªããããã«ã¡ã¯ï¼
VOYAGE MARKETINGã«ã¦ã¨ã³ã¸ãã¢ããã¦ãã なかにしごう (@gomachan46) | Twitter ã§ãã
2014å¹´ãã社å
éå
¬å¼ãµã¼ã¯ã«ã¨ã㦠é³ã²ã¼é¨
ãç«ã¡ä¸ãããæ¼ä¼ã¿ã¯ä¼è°å®¤ã®ããã¸ã§ã¯ã¿ã¼ã§é³ã²ã¼éè³ãå®æå¾ã¯ã²ã¼ã ã»ã³ã¿ã¼ã§ç·´ç¿ã¨ãç¾å¨ããªãå
æ°ã«æ´»åãã¦ãã¾ãã
ãã¦ãä»åã¯ã¿ã¤ãã«ã®éã WebSocketãç¨ããå
¨ãæ°ããOAuth
ããç´¹ä»ãããã¨æãã¾ãã
ãåç¥ã®æ¹ãå¤ãã¨ã¯æãã¾ãããããã£ã¨ç°¡åã«ç¨èªã®èª¬æããã¦ãããã¨æãã¾ãã
WebSocket
WebSocketï¼ã¦ã§ãã½ã±ããï¼ã¯ãã³ã³ãã¥ã¼ã¿ã»ãããã¯ã¼ã¯ç¨ã®éä¿¡è¦æ ¼ã®1ã¤ã§ãããã¤ã³ã¿ã¼ãããã®æ¨æºåå£ä½ã§ããW3Cã¨IETFãã¦ã§ããµã¼ãã¼ã¨ã¦ã§ããã©ã¦ã¶ã¨ã®éã®éä¿¡ã®ããã«è¦å®ãäºå®ãã¦ããåæ¹åéä¿¡ç¨ã®æè¡è¦æ ¼ã§ãããAPIã¯W3CããWebSocket ãããã³ã«ã¯IETFãçå®ã«é¢ä¸ãã¦ããããããã³ã«ã®ä»æ§ã¯ RFC 6455ãTCPä¸ã§åãã
åè: WebSocket - Wikipedia
ç¹æ§ä¸ããã£ãããªã©ã®ãªã¢ã«ã¿ã¤ã æ§ãæ±ãããããããªã±ã¼ã¹ã«å©ç¨ãããããã¦ãã¾ãã
ActionCable
Rails5ç³»ããã®æ°æ©è½ã§ã Rails
㨠WebSocket
ãã¤ãªãããã«ç¨æããããã®ã§ãã
ãããç¨ãããã¨ã§ Railsã®è¯ãã¯ãã®ã¾ã¾ã«ããªã¢ã«ã¿ã¤ã éä¿¡ãç°¡åã«æ±ããããã«ãªãã¾ããã
OAuth
OAuth
ã¨ã¯ã Otoge Authorization ã®ç¥ã§ãã
Otogeã¨ã¯
ç°¡åã«ããã¨ãªãºã ã«åãã¦ä½æãããèé¢ã®éãã«ãã¿ã³ãæ¼ãã¦éã¶ã²ã¼ã ã§ããé³ã²ã¼ã§ãã
以åãããã ãã ãã¨èªç¥åº¦ãä¸ãã£ã¦ãã¦ããããã«æãã¾ããï¼
OAuth
ã¯ããã®é³ã²ã¼ã§å¯¾æ¦ãè¡ããç¸æãããé«ãã¹ã³ã¢ãåºããã¨ã§ãã°ã¤ã³ãããã¨ãåºæ¥ãã¨ããå
¨ãæ°ããèªè¨¼æ¹å¼ã§ãï¼ï¼*1
ä»åã¯ãã® OAuth
ãã ActionCable
ãç¨ãã¦å®è£
ãã¦ã¿ã¾ããï¼
ãã¢
æ©éã§ããç¾èã¯ä¸è¦ã«å¦ããã¨ãããã¨ã§ãã¢ãã©ããï¼(åç»åãè¾¼ã¿ã ã¨å°ãããããããªãã§ã)
OAuth
ãç¨ãããã°ã¤ã³ã®æµãããã¨ãã¨ã覧ãã ããã
ä¸ããè½ã¡ã¦ãããã°ã¤ã³ãã¿ã³ã...
ã¿ã¤ãã³ã°ããã¯ãªãã¯ï¼é ¼ããï¼ãã°ã¤ã³ããã¦ãããððð
åè ã«ã¯çã®ãã°ã¤ã³ãã¿ã³ãä¸ãããããããããã°ã¤ã³ãããã¨ãã§ãã¾ãã
使ã£ã¦ããæè¡
éè¤ãããã¾ãããã£ã¨è§¦ã£ãæè¡ãæ¸ãã¦ããã¾ãmm
å ¨ã¦è§¦ã£ããã¨ã®ãªãæè¡ã§ãªãããããããã¨ããæãã®ã¾ã¾æ°ã¥ãã°ããã°æ稿2æ¥åãè¿ãã¾ããããªãã¨ãåããã¨ããã¾ã§åºæ¥ã¦ããã£ãã§ãw
ã³ã¼ãã¯éãæ±ãã¦ãã¾ãããã¡ã GitHub - gomachan46/action-cable-oauth: OAuth
WebSocket
以ä¸ã®ãããªæ
å ±ã WebSocket
ãç¨ãã¦pushããã£ã¦ãã¾ãã
- 対æ¦ç¸æã®joinæ å ±
- ãã¬ã¤éå§æ å ±
- åãã¬ã¤ã¤ã¼ã®ã³ã³ãæ å ±
- åãã¬ã¤ã¤ã¼ã®ã¹ã³ã¢æ å ±
- ãã¬ã¤çµäºæã®åæ
Rails5
Rails5
系㧠ActionCable
ãç¨ãã¦ãã¾ãã
enchant.js
ãããã°ããæ´æ°ãæ¢ã¾ã£ã¦ãããã§ããã¨ããããéã«ã²ã¼ã ã£ã½ãã®ãåãããããã ãï¼ã¨ãããã¨ã§çªã£è¾¼ãã§ãã¾ãã
Rails
ä¸ã«çªã£è¾¼ãã®ãå¿
è¦ã ã£ãã®ã§ä»¥ä¸ã®è¨äºãã¹ã©ã¤ããããã主ã«åèã«ãã¾ããã
é³ã²ã¼
é³ã²ã¼ãéã«ã§ãå®è£ ããå¿ è¦ããã£ãã®ã§ã以ä¸ã®è¨äºãåèã«ããªããå®è£ ãã¾ããã
åèè¨äºã®çããã大å¤å©ããã¾ããmmãããã¨ããããã¾ããmm
ã¹ãã¼ãæããªã¢ã«ã¿ã¤ã æ
æå¤ã¨(?)å²ã¨æ®éã«é³ã²ã¼åºæ¥ããªã¨è¨ãæãã§ããï¼
åç»ã®é³å£°ã2ã¦ã£ã³ãã¦ã§åæã«åçããã¦ãããããªã®ã§ãããã»ã¼ãºã¬ãæãããã¨ãªãèããã¦ããã®ã§ã¯ãªããã¨æãã¾ãð¤
å¦çããç©éãå¢ããã¨ããªã©ã©ããªã£ã¦ãããã¯è¦ç¢ºèªã§ãããã¡ããã¨ä½ã£ãããããªãã«é¢ç½ããã®ãåºæ¥ãå¯è½æ§ãæãããªã©ãã¾ããw
ãããã«
ãããã§ããã§ããããï¼
ãããæªæ¥ã®èªè¨¼æ¹å¼ã OAuth
ã§ãã
ã¿ãªããã WebSocketãç¨ããå
¨ãæ°ããOAuth
ããã²ãµã¼ãã¹ã«çãè¾¼ãã§æé«ã®ãã°ã¤ã³ä½é¨ãï¼ï¼
ææ¥ã®æ´æ°ãã楽ãã¿ã«ãð
é¢é£
VOYAGE GROUP エンジニアブログ : あなたにおすすめするたった一つの最高のキーボード
*1:ãããè¨ãããã£ãã ããè²ã ããã³ãã©ããã¯ãããã©ãã¾ããããããããã ãï¼ï¼â