Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
LoopBackを使った極初歩的なAPIとSwiftで作るオシャレアプリ__.pdf
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
moomoo-ya
July 02, 2015
82
0
Share
LoopBackを使った極初歩的なAPIとSwiftで作るオシャレアプリ__.pdf
moomoo-ya
July 02, 2015
More Decks by moomoo-ya
See All by moomoo-ya
サービスを陳腐化させない組織だった技術刷新 / Technology Renewal Initiatives
moomooya
0
1.6k
はじめてのオンラインイベント配信 with COVID-19 バグ修正版 / Online-Event-bugfixed
moomooya
0
150
一番安い子だーれだ?~黒字化のための無慈悲なタスク配分~ / Distribute tasks
moomooya
1
3.4k
はじめてのオンラインイベント配信 with COVID-19 バグあり版 / Online-Event-includes-bug
moomooya
0
880
やはり俺のLT登壇はまちがっている。 / my-lightning-talk-is-wrong-as-i-expected
moomooya
4
2.6k
Gatsby.jsで.md/.adocが混在できるテンプレートを作ったときの苦しみ / Pain-to-create-gatsby-template-that-supports-markdown-and-asciidoc
moomooya
0
690
LADRのすすめ&先行技術検証PRJの紹介 / Introducing-LADR-and-Technology-verification
moomooya
5
2.9k
技術書へのアクセスを劇的に向上させた話 / oreilly-safari-and-acm-membership
moomooya
2
7.8k
モノリスにおけるビジネスロジックの設計 ~アグリゲートパターン~ / aggregate-pattern-for-domain-modeling-on-monolithic
moomooya
2
1.7k
Featured
See All Featured
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
110
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
500
So, you think you're a good person
axbom
PRO
2
2k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
350
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
200
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
160
The Spectacular Lies of Maps
axbom
PRO
1
740
Information Architects: The Missing Link in Design Systems
soysaucechin
0
920
Amusing Abliteration
ianozsvald
1
160
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.4k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.5k
Transcript
LoopBackΛͬͨ ۃॳาతͳWEB-APIͱ SwiftͰ࡞ΔΦγϟϨΞϓϦʢʣ 2015.4.12 Sun. Isamu Suuki RAKUS Co, Ltd.
ླ ༐ • גࣜձࣾϥΫε • ٻॻൃߦαʔϏεΛ։ൃͯ͠·͢ • ࣄͰJavaʴJavaScriptগ͠ • ϓϥΠϕʔτJavaScriptʹશྗࢿத
౦ژNodeֶԂࡇ2014Ͱ
StrongLoopͷ Isaac Rothࢯ͕ LoopBackΛհ
ͳΜ͔؆୯ͳͷ ࡞Ζ͏
CandleShare
1ຊͷΖ͏ͦ͘Λ ΈΜͳͰ;ʔ;ʔ͢Δ WEBαʔϏε
ɿΩεإࡱͬͨΓ͠·ͤΜ ɿΩεإࡱͬͨΓ͠·ͤΜ
͜Μͳײ͡Ͱ࡞Γ·ͨ͠ αʔόͰϐϯΫϊΠζʢ1/fΏΒ͗ʣΛੜͯ͠৴
RemoteMethod͔͠ ͬͯͳ͍
ࢀߟʹͳΓͦ͏ͳͷ Socket.IOͷ ΈࠐΈ͘Β͍ʁ
LoopBackͰͷ Socket.IOར༻
LoopBackͷσΟϨΫτϦߏ app-root /client ͜͜ʹϑϩϯτΤϯυ༻ͷhtmlͱ͔ஔ͘ /common /models ͜͜ʹmodelఆ͕ٛஔ͔ΕΔ /sever /boot ͜͜ʹஔ͔ΕͨϑΝΠϧ͕ىಈ࣌ʹಡΈࠐ·ΕΔͬΆ͍ͷͰ
sio.jsͱ͔దͳϑΝΠϧΛ࡞Δ ※LoopBackͷGoogleGroupΛࢀߟʹ
/server/boot/sio.js module.exports = function(app) { //server.jsͰapp.emit(‘started’)ͯ͠Δ app.on('started', function() { !
//app.serverapp.listen()ͷฦΓೖΕ͓ͯ͘ app.io = require(‘socket.io').listen(app.server) ! //దͳσΟϨΫτϦͷindex.jsʹapp,app.ioΛ͢ //Α͘ݟͨΒapp͚ͩͰ͍͍Μ͡Ό……orz require('../sio/')(app, app.io); }); }
/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); }
͋ͱiOSΞϓϦ͔Β Socket.IOͰΏΒ͗औಘͯ͠ ϚΠΫೖྗ͋ͬͨΒ /blow APIݺͿ
͢Δͱ͜Μͳײ͡ʹͳΓ·͢
ʢσϞಈըͷ༧ఆʣ
࠷ޙʹ એ͍ͤͯͩ͘͞͞
גࣜձࣾɹɹɹ ΤϯδχΞΛืू͍ͯ͠·͢