Swift3 Framework Slimane and Server Side Swift (ja)

9ebab3d4f66a62a859ad238e7e97597f?s=47 Yuki Takei
August 19, 2016

Swift3 Framework Slimane and Server Side Swift (ja)

iOSDC 2016 Aug, 19

9ebab3d4f66a62a859ad238e7e97597f?s=128

Yuki Takei

August 19, 2016
Tweet

Transcript

  1. Swift3 Framework Slimane and Server Side Swift Yuki Takei @iOSDC

    2016 Aug, 19
  2. Yuki Takei (@noppoMan722) ϑϦʔϥϯειϑτ΢ΣΞΤϯδχΞ iDEAKITTͱ͍͏ελʔτΞοϓͰϦʔυσϕϩούʔΛ͍ͯ͠·͢ɻ ΠϯϑϥɺWebɺiOSɺࣗવݴޠॲཧͳͲΛ΍Γ·͢ɻ ˎ࠷ۙɺΩʔϘʔυʢγϯηαΠβʔʣΛ࢝Ί·ͨ͠ɻ ࣗݾ঺հ

  3. None
  4. Tokyo Server Side Swift Meetup ΛෆఆظͰ։࠵͓ͯ͠Γ·͢(স) εϐʔΧʔืूதʂʂʂʂ ࣍ճͷձ৔͸Onlab(ܙൺण)༧ఆ

  5. Έͳ͞ΜɺServer SideͰ΋Swiftॻ͍ͯ·͔͢ʁ

  6. Swift͕OSSʹͳͬͯૣ൒೥Ҏ্

  7. ͜ͷ൒೥ؒͰͨ͘͞ΜͷSwift੡Web Frame Work ͕ొ৔͖ͯ͠·ͨ͠ɻ

  8. ·ͨ๻ݸਓͱͯ͠΋͜ͷ൒೥ؒ͸ɺ Server Side SwiftͱָۤΛͱ΋ʹͨ͠೔ʑͰͨ͠ʢসʣ

  9. 2016/01ɺSlimane։ൃ։࢝ʂΑ͓͓͠ؤுΔ͓ͧʂ

  10. 2016/02ɺҰ௨Γग़དྷͨʂMeet up΍ͬͪΌ͏͓ͧʂ

  11. 2016/03ɺ͋ΕʁSwift Updateͨ͠ΒίϯύΠϧͰ͖ͳ͍ͧ

  12. 2016/04ɺ·ͨग़དྷͳ͍ɻυϥεςΟοΫʹ࢓༷͕มΘͬͯ͘…

  13. 2016/05ɺmacͩͱಈ͘ͷʹɺLinuxͩͱಈ͔ͳ͍….

  14. 2016/06ɺϙΠϯλपΓͷAPI͛͢ʔมΘͬͯΔ΍Μ͚ʂʂ

  15. 2016/07ɺώϟοϋʔww @escaping ww

  16. ·͡Ͱɺ10000Օॴ͘Β͍Swift3ͷΞοϓσʔτʹΑΔίϯύ ΠϧΤϥʔ௚͠·ͨ͠

  17. ͦͷ͘Β͍ͷεϐʔυͰSwift3͸੒௕͍ͯ͠·͢ɻ

  18. ࿩͕ͦΕ·͕ͨ͠ɺɺ

  19. ຊ೔͸ɺ൒೥ؒͷOSS Swiftͷ׆ಈΛ௨ͨ͠ूେ੒తͳ͓࿩͕ ग़དྷΕ͹ͱࢥ͍·͢ɻ ʢओʹWeb FrameWorkͱͦΕʹవΘΔ͓࿩Ͱ͢ɻʣ

  20. ·ͣ͸ɺͲΜͳϑϨʔϜϫʔΫ͕Ͳ͏͍ͬͨࢥ૝΍ٕज़Ͱ ݱΕ͍ͯΔͷ͔ɻ

  21. ݱ࣌఺ͰؾʹͳΔ΋ͷΛϐοΫΞοϓͯ͠͝঺հ͍ͨ͠·͢ɻ

  22. IBM Kitura

  23. IBM Kitura Vapor

  24. Vapor IBM Kitura Zewo

  25. Vapor IBM Kitura Zewo Slimane

  26. ZewoɺVeniceX ΄΅ݸਓɻɻorz Vapor IBM Kitura Communities

  27. Super Moduler/Full Stack Express Inspired/Tiny, Faster Laravel Inspired Full Stack/Popular

    Sinatra, Express like, From IBM Futures
  28. CSP Event Loop Model+Master/Worker Pattern Prefork Model Prefork Model Concurrency/Parallelism

    Models
  29. Simple Full Stack Faster Slower

  30. Open-swift Original+Core Foundation Denominations Open-swift Open-swift

  31. Open-Swift?

  32. None
  33. • Cross Project Standard for SwiftΛᨳͬͨɺCore- Foundationͷ࠶ఆٛٴͼϦϓϨΠεΛ໨తͱ͠ ͨϓϩδΣΫτ • ProtocolΛఆΊͨ΋ͷʢ΄΅੍໿ʣͷͨΊɺϩ

    δοΫϨε • ओʹWebΞϓϦέʔγϣϯ޲͚ Open-Swiftͱ͸
  34. • C7ɿCore standards for Swift • S4: HTTP standards for

    Swift • D5: Database standards for Swift ҎԼͷ3ͭͷϨϙδτϦ͕ଘࡏ͢Δ
  35. C7 • Stream • Connection • Data • URI •

    JSON Stream(TCPɺPipe etc..)ɺURIɺDataߏ଄ͳͲͷɺ ΞϓϦέʔγϣϯͷجຊ෦෼ͷ࢓༷ɺΠϯλʔϑΣʔε
  36. • Request • Response • HTTP Status Code • Server

    • Middleware • Responder S4 WebͷͨΊͷ࢓༷ɺΠϯλʔϑΣʔε(rubyͷrackʹ͍ۙ)
  37. D5 DB΍ϞσϧͷͨΊͷ࢓༷ɺΠϯλʔϑΣʔε ·ͩREADME.md͔͠ίϛοτ͞Ε͓ͯΒͣɺ ৄ͘͠͸Θ͔Γ·ͤΜʢരʣ

  38. ͳͥɺOpen-Swift͕ඞཁͳͷ͔

  39. • Swift୯ମʹ͸Web։ൃͷج൫͸ͳ͍ • CFͷAPIͷந৅౓͕௿͍ɺObjetive-CΛࣺ͖ͯΕͳ͍ • OSS൛ͷCF͸ະ࣮૷ͳ΋ͷ͕͋Γɺmac΄ͲϦονʹ ੔͍ͬͯͳ͍ɻ • αʔόʔଆͷ࣮૷ʹ͸ଟ͘ͷύϥμΠϜ͕ଘࡏ͠ɺΠϯ λʔϑΣʔε͕όϥόϥʹͳΓ͕ͪɻ

    • Server SideϓϩάϥϜݴޠ/؀ڥͷൃలͷཪʹ͸ɺ͍ͭ Ͱ΋ΤίγεςϜ͕͋ͬͨ
  40. ࠓޙͷServer Side SwiftൃలͷͨΊɺΦϨΦϨ͸΍Ί·͠ΐ͏ ʢͱ͸͍͑ɺCore-Foundation͕Μ͹ͬͯʂʂʂʂʂʂʣ

  41. ͜͜·Ͱ͕Server Side Swiftʹؔ͢Δ͓࿩Ͱ͢ɻ

  42. Slimaneͷ঺հ

  43. None
  44. None
  45. • ExpressΛinspireͨܰ͠ྔWAF/Web Server • Node.jsͷ5ഒɺRevelͷ2ഒߴ଎ʢͩͬͨʣ • ΠϕϯτϧʔϓϞσϧɺϊϯϒϩοΩϯάI/O • Master/WorkerύλʔϯʹΑΔϚϧνεϨουରԠ •

    Core Foundationʹґଘ͠ͳ͍ • ϚΠΫϩαʔϏε޲͚ͷAPIαʔόʔ΍SwiftͰඇಉظωοτ ϫʔΫϓϩάϥϛϯάΛߦ͏͜ͱ͕ओ໨త Slimaneͱ͸
  46. ৄ͘͠ݟ͍͖ͯ·͠ΐ͏

  47. • Middleware/Router+HTTP Server • RailsͷΑ͏ͳFull StackϑϨʔϜϫʔΫͰ͸ͳ͍ • ඞཁʹԠͯ͡MɺVΛબ୒ • Network΍FileSystem͸Suv͕ఏڙ͍ͯ͠Δ΋ͷΛ

    ར༻͢Δ(Suv.TCPSocketɺSuv.FsͳͲ) Slimaneͷ࣮ଶ͸ͱͯ΋খ͍͞
  48. Layer system call thread pool event loop Swift bindings of

    libuv Async net working platform TCP, UDP, Process, FS, DNS etc.. HTTP Server WAF(Routing, Middleware)
  49. Runtime EVENT LOOP FILE SYSTEM NETWORK NETWORK System Operation &

    Register Callback COMPUTATION Operation Complete Trigger Callback Requests Suv(libuv wapper) epoll kqueue worker threads
  50. Ͱ͸ɺSlimaneΛΠϯετʔϧͯ͠Έ·͠ΐ͏

  51. ίϚϯυϥΠϯπʔϧ͕͋Γ·͢ɻ

  52. $ npm i -g slimane-cli

  53. ➜ slimane git:(master) ✗ slimane new TestApp [~/Documents/program/oss/slimane/slimane] /Users/yuki/Documents/program/oss/Slimane/Slimane/TestApp ├──

    Makefile ├── Package.swift ├── Sources │ ├── app.swift │ └── main.swift └── public └── images └── Slimane_logo.jpg 3 directories, 5 files ➜ TestApp git:(master) ✗ slimane build ここでSPMの依存解決、コンパイルが走る。(結構時間かかります。) ➜ TestApp git:(master) ✗ .build/debug/TestApp [~/Documents/program/oss/slimane/slimane/TestApp] The server is listening at 0.0.0.0:3000 [pid:50928] Monday, August 01 2016 00:11:48 /
  54. ➜ slimane git:(master) ✗ slimane new TestApp [~/Documents/program/oss/slimane/slimane] /Users/yuki/Documents/program/oss/Slimane/Slimane/TestApp ├──

    Makefile ├── Package.swift ├── Sources │ ├── app.swift │ └── main.swift └── public └── images └── Slimane_logo.jpg 3 directories, 5 files ➜ TestApp git:(master) ✗ slimane build ここでSPMの依存解決、コンパイルが走る。(結構時間かかります。) ➜ TestApp git:(master) ✗ .build/debug/TestApp [~/Documents/program/oss/slimane/slimane/TestApp] The server is listening at 0.0.0.0:3000 [pid:50928] Monday, August 01 2016 00:11:48 / ϓϩδΣΫτͷεχϖοτΛ࡞੒
  55. ➜ slimane git:(master) ✗ slimane new TestApp [~/Documents/program/oss/slimane/slimane] /Users/yuki/Documents/program/oss/Slimane/Slimane/TestApp ├──

    Makefile ├── Package.swift ├── Sources │ ├── app.swift │ └── main.swift └── public └── images └── Slimane_logo.jpg 3 directories, 5 files ➜ TestApp git:(master) ✗ slimane build ここでSPMの依存解決、コンパイルが走る。(結構時間かかります。) ➜ TestApp git:(master) ✗ .build/debug/TestApp [~/Documents/program/oss/slimane/slimane/TestApp] The server is listening at 0.0.0.0:3000 [pid:50928] Monday, August 01 2016 00:11:48 /
  56. ➜ slimane git:(master) ✗ slimane new TestApp [~/Documents/program/oss/slimane/slimane] /Users/yuki/Documents/program/oss/Slimane/Slimane/TestApp ├──

    Makefile ├── Package.swift ├── Sources │ ├── app.swift │ └── main.swift └── public └── images └── Slimane_logo.jpg 3 directories, 5 files ➜ TestApp git:(master) ✗ slimane build ここでSPMの依存解決、コンパイルが走る。(結構時間かかります。) ➜ TestApp git:(master) ✗ .build/debug/TestApp [~/Documents/program/oss/slimane/slimane/TestApp] The server is listening at 0.0.0.0:3000 [pid:50928] Monday, August 01 2016 00:11:48 / SPMɺModuleMapͷґଘղܾ / ίϯύΠϧ
  57. ➜ slimane git:(master) ✗ slimane new TestApp [~/Documents/program/oss/slimane/slimane] /Users/yuki/Documents/program/oss/Slimane/Slimane/TestApp ├──

    Makefile ├── Package.swift ├── Sources │ ├── app.swift │ └── main.swift └── public └── images └── Slimane_logo.jpg 3 directories, 5 files ➜ TestApp git:(master) ✗ slimane build ここでSPMの依存解決、コンパイルが走る。(結構時間かかります。) ➜ TestApp git:(master) ✗ .build/debug/TestApp [~/Documents/program/oss/slimane/slimane/TestApp] The server is listening at 0.0.0.0:3000 [pid:50928] Monday, August 01 2016 00:11:48 /
  58. ➜ slimane git:(master) ✗ slimane new TestApp [~/Documents/program/oss/slimane/slimane] /Users/yuki/Documents/program/oss/Slimane/Slimane/TestApp ├──

    Makefile ├── Package.swift ├── Sources │ ├── app.swift │ └── main.swift └── public └── images └── Slimane_logo.jpg 3 directories, 5 files ➜ TestApp git:(master) ✗ slimane build ここでSPMの依存解決、コンパイルが走る。(結構時間かかります。) ➜ TestApp git:(master) ✗ .build/debug/TestApp [~/Documents/program/oss/slimane/slimane/TestApp] The server is listening at 0.0.0.0:3000 [pid:50928] Monday, August 01 2016 00:11:48 / Ϗϧυޙʹग़དྷ্͕ͬͨόΠφϦΛ࣮ߦ
  59. ϒϥ΢βͰ֬ೝ

  60. ͜Ε͚ͩͷ؆୯ͳStepͰɺϓϩδΣΫτΛ։࢝Ͱ͖·͢ɻ

  61. Slimaneىಈ·ͰͷίʔυΛ௥͍͖ͬͯ·͠ΐ͏

  62. Routing

  63. • get • put/patch • post • delete • option

    RouterͰରԠ͍ͯ͠Δϝιου
  64. S4.AsyncResponder

  65. S4.AsyncResponder શͯͷResponder͸AsyncResponderΛ࣮૷͢Δඞཁ͕͋Δ

  66. struct HelloWorldResponser: AsyncResponder { public func respond(to request: Request, result:

    ((Void) throws -> Response) -> Void) result { Response(body: “Hello world") } } } Responder
  67. app.get("/foo", HelloWorldResponser()) app.get(“/bar/:id”) { request, result in result { Response(body:

    "id is \(request.params["id"]!)") } } Routingͷίʔυ(ొ࿥)
  68. Middleware

  69. S4.AsyncMiddleware.swift

  70. S4.AsyncMiddleware.swift શͯͷMiddleware͸AsyncMiddlewareΛ࣮૷͢Δඞཁ͕͋Δ

  71. MiddlewareͷίʔυʢϩάΠϯνΣοΫʣ public struct AuthenticationMiddleware: AsyncMiddleware { public func respond(to request:

    Request, chainingTo next: AsyncResponder, result: ((Void) throws -> Response) -> Void) { if request.session?["isAuthorized"] != nil { return next.respond(to: request, result: result) } result { Response(status: .unauthorized) } } }
  72. MiddlewareͷίʔυʢϩάΠϯνΣοΫʣ public struct AuthenticationMiddleware: AsyncMiddleware { public func respond(to request:

    Request, chainingTo next: AsyncResponder, result: ((Void) throws -> Response) -> Void) { if request.session?["isAuthorized"] != nil { return next.respond(to: request, result: result) } result { Response(status: .unauthorized) } } } ϩάΠϯ͍ͯͨ͠Β࣍ͷMiddlewareʹνΣΠϯ
  73. MiddlewareͷίʔυʢϩάΠϯνΣοΫʣ public struct AuthenticationMiddleware: AsyncMiddleware { public func respond(to request:

    Request, chainingTo next: AsyncResponder, result: ((Void) throws -> Response) -> Void) { if request.session?["isAuthorized"] != nil { return next.respond(to: request, result: result) } result { Response(status: .unauthorized) } } } ϩάΠϯ͍ͯ͠ͳ͚Ε͹ɺ401Λฦ͢
  74. app.use(StaticFileServingMiddleware()) app.use { request, next, result in print("Hello") next.respond(to: request,

    result: result) } Middlewareͷίʔυ(ొ࿥)
  75. HTTP Server

  76. import Slimane let app = Slimane() try app.listen()

  77. ૊Έ߹ΘͤΔͱ…. import Slimane let app = Slimane() app.use { req,

    next, result in print("middleware") next.respond(to: req, result: result) } app.get("/") { req, responder in responder { Response(body: "Hello iOSDC") } } try! app.listen() // => listening at 0.0.0.0:3000
  78. Express Slimane const express = require('express'); const app = express();

    app.use((req, res, next) => { console.log("middleware"); next(); }); app.get("/", (req, res) => { res.send("Hello iOSDC"); }); app.listen(); // => listening at 0.0.0.0:3000 import Slimane let app = Slimane() app.use { req, next, result in print("middleware") next.respond(to: req, result: result) } app.get("/") { req, responder in responder { Response(body: "Hello iOSDC") } } try! app.listen() // => listening at 0.0.0.0:3000 ίʔυΛExpressͱൺֱ
  79. Express Slimane const express = require('express'); const app = express();

    app.use((req, res, next) => { console.log("middleware"); next(); }); app.get("/", (req, res) => { res.send("Hello iOSDC"); }); app.listen(); // => listening at 0.0.0.0:3000 import Slimane let app = Slimane() app.use { req, next, result in print("middleware") next.respond(to: req, result: result) } app.get("/") { req, responder in responder { Response(body: "Hello iOSDC") } } try! app.listen() // => listening at 0.0.0.0:3000 ίʔυΛExpressͱൺֱ ׂͱࣅͯ·͢Ͷɻ
  80. ͜͜·Ͱ͕Slimaneʹؔ͢Δ࠷ॳͷεςοϓͱͳΓ·͢ɻ

  81. ࣍͸ɺSlimaneΛ֦ுͯ͠΋͏গ͠Ϧονʹͯ͠Έ·͠ΐ͏ɻ

  82. View

  83. None
  84. RenderΛSlimaneʹΠϯετʔϧ͢Δ͜ͱͰɺςϯϓϨʔτΤ ϯδϯΛ࢖ͬͨಈతίϯςϯπΛ഑৴ՄೳʹͳΓ·͢ɻ

  85. import Slimane import Render import MustacheViewEngine let app = Slimane()

    app.get("/") { req, result in result { let templateData: TemplateData = ["name": "Slimane"] let render = Render(engine: MustacheViewEngine(templateData: templateData), path: “index”) return Response(custom: render) } } try! app.listen() RenderΛ࢖ͬͯHTMLΛ഑৴͢Δྫ
  86. import Slimane import Render import MustacheViewEngine let app = Slimane()

    app.get("/") { req, result in result { let templateData: TemplateData = ["name": "Slimane"] let render = Render(engine: MustacheViewEngine(templateData: templateData), path: “index”) return Response(costom: render) } } try! app.listen() RenderΛ࢖ͬͯHTMLΛ഑৴͢Δྫ MustacheViewEngineΛengineͱͯ͠ɺ RenderΦϒδΣΫτΛ࡞੒
  87. import Slimane import Render import MustacheViewEngine let app = Slimane()

    app.get("/") { req, result in result { let templateData: TemplateData = ["name": "Slimane"] let render = Render(engine: MustacheViewEngine(templateData: templateData), path: “index”) return Response(custom: render) } } try! app.listen() RenderΛ࢖ͬͯHTMLΛ഑৴͢Δྫ Response.initializerͷcostom labelʹ render ObjectΛ౉͢
  88. <!DOCTYPE html> <html> <meta charset="utf-8"> <head> <title>{{name}}</title> </head> <body> Welcome

    to {{name}} </body> </html> views/index.mustache
  89. JSON

  90. None
  91. Zewo/JSONͱBodyParserΛ࢖͍ɺJSONΛѻ͍·͢ɻ

  92. import Slimane import BodyParser import JSON let app = Slimane()

    app.use(BodyParser.JSON()) app.post("/") { req, responder in print(req.json?[“string”].asString) print(req.json?[“number”].asNumber) print(req.json?[“object”].asObject) responder { let successJSON: JSON = ["message": "OK"] Response( status: .created, headers: Header([“Content-Type”: “application/json“]), body: try JSONMapSerializer.serialize(successJSON) ) } } application/jsonͷRequest/Responseͷྫ
  93. import Slimane import BodyParser import JSON let app = Slimane()

    app.use(BodyParser.JSON()) app.post("/") { req, responder in print(req.json?[“string”].asString) print(req.json?[“number”].asNumber) print(req.json?[“object”].asObject) responder { let successJSON: Map = ["message": "OK"] Response( status: .created, headers: Header([“Content-Type”: “application/json“]), body: try JSONMapSerializer.serialize(successJSON) ) } } main.swift JSON BodyParserΛMiddlewareʹొ࿥
  94. import Slimane import BodyParser import JSON let app = Slimane()

    app.use(BodyParser.JSON()) app.post("/") { req, responder in print(req.json?[“string”].asString) print(req.json?[“number”].asNumber) print(req.json?[“object”].asObject) responder { let successJSON: Map = ["message": "OK"] Response( status: .created, headers: Header([“Content-Type”: “application/json“]), body: try JSONMapSerializer.serialize(successJSON) ) } } main.swift JSON Value΁ͷΞΫηε
  95. import Slimane import BodyParser import JSON let app = Slimane()

    app.use(BodyParser.JSON()) app.post("/") { req, responder in print(req.json?[“string”].asString) print(req.json?[“number”].asNumber) print(req.json?[“object”].asObject) responder { let successJSON: JSON = ["message": "OK"] Response( status: .created, headers: Header([“Content-Type”: “application/json“]), body: try JSONSerializer.serialize(successJSON) ) } } main.swift JSONܕ(Type safeͳߏ଄ܕ)ͰDictionaryΛੜ੒͠ɺ JSONSerializer.serializeʹ౉͢͜ͱͰJSONStringʹ
  96. Blocking Operation

  97. event loop͸ࢭΊͯ͸ͳΒͳ͍ʂ

  98. • ϑΟϘφονͳͲͷಉظతͳ࠶ؼؔ਺ • ҉߸Խॲཧɺը૾ॲཧͳͲ • libmysqlͳͲΛ࢖ͬͨϒϩοΩϯάI/O event loop͕ࢭ·Δྫ

  99. Ͱ΋ɺ͜ΕΒͷॲཧͬͯ࢖͑ͳ͘ͳͬͨΒࠔΓ·͢ΑͶʁ

  100. Process.qwork

  101. ίʔυ import Suv let onThread = { ctx in let

    sql = "select * from foo where bar = 1" let ctx.storage[“result”] = mysql_real_query(con, sql, sql.characters.count) let res = mysql_use_result(con) result = mysql_foo..... } let onFinish = { ctx in print(ctx.storage[“result”]) } Process.qwork(onThread: onThread, onFinish: onFinish)
  102. ͱɺଞʹ΋·ͩ·ͩͨ͘͞Μ͋ΔͷͰ͕͢ɺ ࣌ؒͷ౎߹Ͱશͯ͝঺հͰ͖ͣɺɺ

  103. https://github.com/slimane-swift/ ڵຯ͕͋Δํ͸ɺ SlimaneͷϓϩδΣΫτϖʔδΛੋඇޚཡ͍ͩ͘͞ɻ

  104. ͦΖͦΖಈ͍͍ͯΔͱ͜Ζ͕Έ͍ͨͰ͢ΑͶʁ

  105. Ͱ͸ɺ

  106. SlimaneΛ࢖࣮ͬͨફతͳWeb Application ͷ࣮૷ʹ޲͚ͯ࿩͍͖ͯ͠·͢ɻ

  107. ྫ͑͹ɺGithubΞΧ΢ϯτΛ࢖ͬͨChatαʔϏε ͷ࣮૷Λߟ͑ͯΈ·͠ΐ͏ɻ

  108. • HTTPS Client • JSON • Session • DataBaseClient •

    View • Web socket Server/Client • Deploy SlimaneҎ֎ͰɺGithubΞΧ΢ϯτΛ࢖ͬͨ ChatαʔϏεʹඞཁͳ΋ͷ
  109. • HTTPS Client -> slimane-swift/SecureHanger • JSON • Session •

    DataBaseClient • View • Web socket • Deploy SlimaneҎ֎ͰɺTwitterΞΧ΢ϯτΛ࢖ͬͨ ChatΞϓϦʹඞཁͳ΋ͷ
  110. • HTTPS Client -> slimane-swift/SecureHanger • JSON -> Zewo/JSON, slimane-swift/BodyParser

    • Session • DataBaseClient • View • Web socket • Deploy SlimaneҎ֎ͰɺTwitterΞΧ΢ϯτΛ࢖ͬͨ ChatΞϓϦʹඞཁͳ΋ͷ
  111. • HTTPS Client -> slimane-swift/SecureHanger • JSON -> Zewo/JSON, slimane-swift/BodyParser

    • Session -> slimane-swift/SessionMiddleware • DataBaseClient • View • Web socket • Deploy SlimaneҎ֎ͰɺTwitterΞΧ΢ϯτΛ࢖ͬͨ ChatΞϓϦʹඞཁͳ΋ͷ
  112. • HTTPS Client -> slimane-swift/SecureHanger • JSON -> Zewo/JSON, slimane-swift/BodyParser

    • Session -> slimane-swift/SessionMiddleware • DataBaseClient -> noppoMan/swift-redis • View • Web socket • Deploy SlimaneҎ֎ͰɺTwitterΞΧ΢ϯτΛ࢖ͬͨ ChatΞϓϦʹඞཁͳ΋ͷ
  113. • HTTPS Client -> slimane-swift/SecureHanger • JSON -> Zewo/JSON, slimane-swift/BodyParser

    • Session -> slimane-swift/SessionMiddleware • DataBaseClient -> noppoMan/swift-redis • View -> slimane-swift/Render • Web socket • Deploy SlimaneҎ֎ͰɺTwitterΞΧ΢ϯτΛ࢖ͬͨ ChatΞϓϦʹඞཁͳ΋ͷ
  114. • HTTPS Client -> slimane-swift/SecureHanger • JSON -> Zewo/JSON, slimane-swift/BodyParser

    • Session -> slimane-swift/SessionMiddleware • DataBaseClient -> noppoMan/swift-redis • View -> slimane-swift/Render • Web socket -> slimane-swift/WS • Deploy SlimaneҎ֎ͰɺTwitterΞΧ΢ϯτΛ࢖ͬͨ ChatΞϓϦʹඞཁͳ΋ͷ
  115. • HTTPS Client -> slimane-swift/SecureHanger • JSON -> Zewo/JSON, slimane-swift/BodyParser

    • Session -> slimane-swift/SessionMiddleware • DataBaseClient -> noppoMan/swift-redis • View -> slimane-swift/Render • Web socket -> slimane-swift/WS • Deploy -> Suv.Cluster and Suv.Signal SlimaneҎ֎ͰɺTwitterΞΧ΢ϯτΛ࢖ͬͨ ChatΞϓϦʹඞཁͳ΋ͷ
  116. શ෦࡞Γ·ͨ͠ (ʆʀωʀ´)

  117. Ͱ͸ɺ࣮ࡍʹDemoͰಈ͔ͯ͠Έ·͠ΐ͏ɻ

  118. None
  119. ͜ΕΛ࢖ͬͯDemoΛߦ͍͖ͬͯ·͢ɻ ιʔείʔυΛݟ͍ͨํ͸ੋඇ git cloneͯ͠Έ ͍ͯͩ͘͞ɻ

  120. publish subscribe storage(Redis) Redis Slimane apps ຊ೔ͷDemoͷߏ੒(on AWS EC2 t2.medium)

    Client
  121. SwiftͰ΋ϞμϯͳWebαʔϏεͷόοΫΤϯυΛ։ൃՄೳͱ ͍͏͜ͱ͕෼͔Γ·ͨ͠ʂ

  122. ·ͱΊ

  123. • ݱࡏ͸Swiftݴޠ΋ϑϨʔϜϫʔΫ΋੒௕ஈ֊ • SwiftͰ΋ؤுΕ͹ϞμϯͳWebΞϓϦ͕ॻ͚Δ • ૑ੈهͳͨΊɺ͕Μ͕ΜίϯτϦϏϡʔλʔʹͳ ΕΔ • ݱࡏͷݴޠ࢓༷తʹඇಉظFW͸͋·Γ͓͢͢Ί͠ ·ͤΜʢসʣ

    • Swift੡ͷWeb Server͸ߴ଎ʹಈ࡞͢Δ
  124. • TLS/HTTP 2.0 • QUIC • Async/Await • Actors or

    Coroutines(Other Project) Next Step
  125. ੋඇҰॹʹSlimaneΛ࡞Γ·͠ΐ͏ʂʂʂ

  126. ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ