LoopBackを使った極初歩的なAPIとSwiftで作るオシャレアプリ__.pdf

0aa238a274c2397214b20d6eed58939b?s=47 moomoo-ya
July 02, 2015
19

 LoopBackを使った極初歩的なAPIとSwiftで作るオシャレアプリ__.pdf

0aa238a274c2397214b20d6eed58939b?s=128

moomoo-ya

July 02, 2015
Tweet

Transcript

  1. LoopBackΛ࢖ͬͨ ۃॳาతͳWEB-APIͱ SwiftͰ࡞ΔΦγϟϨΞϓϦʢʣ 2015.4.12 Sun. Isamu Suuki RAKUS Co, Ltd.

  2. ླ໦ ༐ • גࣜձࣾϥΫε • ੥ٻॻൃߦαʔϏεΛ։ൃͯ͠·͢ • ࢓ࣄͰ͸JavaʴJavaScriptগ͠ • ϓϥΠϕʔτ͸JavaScriptʹશྗ౤ࢿத

  3. ౦ژNodeֶԂࡇ2014Ͱ

  4. StrongLoopͷ Isaac Rothࢯ͕ LoopBackΛ঺հ

  5. ͳΜ͔؆୯ͳ΋ͷ ࡞Ζ͏

  6. CandleShare

  7. 1ຊͷΖ͏ͦ͘Λ ΈΜͳͰ;ʔ;ʔ͢Δ WEBαʔϏε

  8. ஫ɿΩεإࡱͬͨΓ͠·ͤΜ ஫ɿΩεإࡱͬͨΓ͠·ͤΜ

  9. ͜Μͳײ͡Ͱ࡞Γ·ͨ͠ αʔόͰϐϯΫϊΠζʢ1/fΏΒ͗ʣΛੜ੒ͯ͠഑৴

  10. RemoteMethod͔͠ ࢖ͬͯͳ͍

  11. ࢀߟʹͳΓͦ͏ͳͷ͸ Socket.IOͷ ૊ΈࠐΈ͘Β͍ʁ

  12. LoopBackͰͷ Socket.IOར༻

  13. LoopBackͷσΟϨΫτϦߏ੒ app-root /client ͜͜ʹϑϩϯτΤϯυ༻ͷhtmlͱ͔ஔ͘ /common /models ͜͜ʹmodelఆ͕ٛஔ͔ΕΔ /sever /boot ͜͜ʹஔ͔ΕͨϑΝΠϧ͕ىಈ࣌ʹಡΈࠐ·ΕΔͬΆ͍ͷͰ

    sio.jsͱ͔ద౰ͳϑΝΠϧΛ࡞Δ ※LoopBackͷGoogleGroupΛࢀߟʹ
  14. /server/boot/sio.js module.exports = function(app) { //server.jsͰapp.emit(‘started’)ͯ͠Δ app.on('started', function() { !

    //app.server͸app.listen()ͷฦΓ஋ೖΕ͓ͯ͘ app.io = require(‘socket.io').listen(app.server) ! //ద౰ͳσΟϨΫτϦͷindex.jsʹapp,app.ioΛ౉͢ //Α͘ݟͨΒapp͚ͩͰ͍͍Μ͡Ό……orz require('../sio/')(app, app.io); }); }
  15. /server/sio/index.js module.exports = function(app, io) { io.on('connection', function(socket) { console.log('connect...');

    socket.on('disconnect', function() { console.log('disconnect...'); }); }); ! //100msec.ִؒͰemit()͍ͨ͠ͱ͖͸͜Μͳײ͡ setInterval(function(){ io.emit(‘hogehoge’); }, 100); }
  16. ͋ͱ͸iOSΞϓϦ͔Β Socket.IOͰΏΒ͗औಘͯ͠ ϚΠΫೖྗ͋ͬͨΒ /blow APIݺͿ

  17. ͢Δͱ͜Μͳײ͡ʹͳΓ·͢

  18. ʢσϞಈըͷ༧ఆʣ

  19. ࠷ޙʹ એ఻͍ͤͯͩ͘͞͞

  20. גࣜձࣾɹɹɹ͸ ΤϯδχΞΛืू͍ͯ͠·͢