SlideShare una empresa de Scribd logo
1 de 35
Adventures
building 3 realtime
single-page apps 6
   different ways
      @HenrikJoreteg
Case Studies:
1. Frontdesk.im
2. Recondynamics.com
3. &! (andbang.com)
Case #1:
Frontdesk.im
Technology:
Django for account
management, serving the app.
XMPP MUC and pubsub
Strophe.js
Custom JS framework
Key Things Learned
OBSERVABLE MODELS
    ARE ABSOLUTELY A
REQUIREMENT FOR BUILDING
COMPLEX SINGLE-PAGE APPS

       ht @natevw
Authing is kinda slow
Parsing XMPP stanzas in the
 browser is kind of a PITA.
Case #2:
Recon Dynamics
Key Things Learned
Mixed sources of data are
            hard.
1. “Manual” ajax requests
     2. “live channel”
Dealing with larger datasets
    complicates things.
You probably don’t need
“live” access to the historical
             data.
Case #3: &!
(andbang.com)
[show the app, Henrik]
Key Things Learned
Sharing data models and full in-
   memory state between the
    client and the server is:

1. Fun, convenient
2. Hard to secure, not scalable
3. Great for prototyping.
You can use redis as shared
memory between processes/
languages (you just have to
agree on how to use it)
Thoonk is a contract with
redis

github.com/andyet/
thoonk.js
github.com/andyet/
We use thoonk like an
evented database.
changes to thoonk from
anywhere are pushed to the
browser.
Each collection of models has
a corresponding feed in
Thoonk
Thoonk also offers an easy to
use job queue system.
Capsule.js used to define
model schema and user
permissions.
How it works
   initial state transfer

1. User authenticates, we
retrieve and emit team
state of teams they’re on.
Subscribe them to updates
for those feeds.
2. Browser deserializes
state, draws app.
How it stays in sync

1. Client makes rpc calls
based on user interactions.
2. Server validates the rpc
call and puts it into a
thoonk (redis) job queue.
3. Workers take jobs, and
necessary models are
pulled and inflated into
Capsule models.
Permissions are verified by
inflated model. Resulting
objects are edited back to
thoonk feeds.
4. Subscribed thoonk-
clients (on any node
process connected to the
same redis db) transmit
change events to the
browser.
5. Changes are applied to
corresponding models in
the client, the UI responds.
Oh, and we publicly
launched &! today...
Thank you!
           Helpful Resources:
twitter: @HenrikJoreteg
&!: http://andbang.com
Thoonk.js: http://thoonk.com
Backbone.js: http://documentcloud.github.com/backbone/
Capsule.js: https://github.com/andyet/capsule

Más contenido relacionado

Similar a Adventures building 3 realtime single-page apps 6 different ways

Fronteers 20131205 the realtime web
Fronteers 20131205   the realtime webFronteers 20131205   the realtime web
Fronteers 20131205 the realtime webBert Wijnants
 
Large Scale Processing with Django
Large Scale Processing with DjangoLarge Scale Processing with Django
Large Scale Processing with DjangoUdi Bauman
 
Managing Large Flask Applications On Google App Engine (GAE)
Managing Large Flask Applications On Google App Engine (GAE)Managing Large Flask Applications On Google App Engine (GAE)
Managing Large Flask Applications On Google App Engine (GAE)Emmanuel Olowosulu
 
Advanced web application architecture - Talk
Advanced web application architecture - TalkAdvanced web application architecture - Talk
Advanced web application architecture - TalkMatthias Noback
 
Micro Processors Present Technology and Up gradations Required
Micro Processors Present Technology and Up gradations RequiredMicro Processors Present Technology and Up gradations Required
Micro Processors Present Technology and Up gradations Requiredijtsrd
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN StackRob Davarnia
 
Operating Systems R20 Unit 2.pptx
Operating Systems R20 Unit 2.pptxOperating Systems R20 Unit 2.pptx
Operating Systems R20 Unit 2.pptxPrudhvi668506
 
Architecting an ASP.NET MVC Solution
Architecting an ASP.NET MVC SolutionArchitecting an ASP.NET MVC Solution
Architecting an ASP.NET MVC SolutionAndrea Saltarello
 
Chat app case study - xmpp vs SIP
Chat app case study - xmpp vs SIPChat app case study - xmpp vs SIP
Chat app case study - xmpp vs SIPGenora Infotech
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
How it's made - MyGet (CloudBurst)
How it's made - MyGet (CloudBurst)How it's made - MyGet (CloudBurst)
How it's made - MyGet (CloudBurst)Maarten Balliauw
 
Microservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive ProgrammingMicroservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive ProgrammingAraf Karsh Hamid
 
Parallel programs to multi-processor computers!
Parallel programs to multi-processor computers!Parallel programs to multi-processor computers!
Parallel programs to multi-processor computers!PVS-Studio
 
Paper id 27201431
Paper id 27201431Paper id 27201431
Paper id 27201431IJRAT
 
BISSA: Empowering Web gadget Communication with Tuple Spaces
BISSA: Empowering Web gadget Communication with Tuple SpacesBISSA: Empowering Web gadget Communication with Tuple Spaces
BISSA: Empowering Web gadget Communication with Tuple SpacesSrinath Perera
 
NoSQLEU: Different NoSQL tools in Production
NoSQLEU: Different NoSQL tools in ProductionNoSQLEU: Different NoSQL tools in Production
NoSQLEU: Different NoSQL tools in ProductionBit Zesty
 
wire-all-the-things-lambda-days-2023.pdf
wire-all-the-things-lambda-days-2023.pdfwire-all-the-things-lambda-days-2023.pdf
wire-all-the-things-lambda-days-2023.pdfEric Torreborre
 

Similar a Adventures building 3 realtime single-page apps 6 different ways (20)

Meet with Meteor
Meet with MeteorMeet with Meteor
Meet with Meteor
 
Fronteers 20131205 the realtime web
Fronteers 20131205   the realtime webFronteers 20131205   the realtime web
Fronteers 20131205 the realtime web
 
Large Scale Processing with Django
Large Scale Processing with DjangoLarge Scale Processing with Django
Large Scale Processing with Django
 
Managing Large Flask Applications On Google App Engine (GAE)
Managing Large Flask Applications On Google App Engine (GAE)Managing Large Flask Applications On Google App Engine (GAE)
Managing Large Flask Applications On Google App Engine (GAE)
 
Advanced web application architecture - Talk
Advanced web application architecture - TalkAdvanced web application architecture - Talk
Advanced web application architecture - Talk
 
Micro Processors Present Technology and Up gradations Required
Micro Processors Present Technology and Up gradations RequiredMicro Processors Present Technology and Up gradations Required
Micro Processors Present Technology and Up gradations Required
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
 
Operating Systems R20 Unit 2.pptx
Operating Systems R20 Unit 2.pptxOperating Systems R20 Unit 2.pptx
Operating Systems R20 Unit 2.pptx
 
Architecting an ASP.NET MVC Solution
Architecting an ASP.NET MVC SolutionArchitecting an ASP.NET MVC Solution
Architecting an ASP.NET MVC Solution
 
Chat app case study - xmpp vs SIP
Chat app case study - xmpp vs SIPChat app case study - xmpp vs SIP
Chat app case study - xmpp vs SIP
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
How it's made - MyGet (CloudBurst)
How it's made - MyGet (CloudBurst)How it's made - MyGet (CloudBurst)
How it's made - MyGet (CloudBurst)
 
Microservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive ProgrammingMicroservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive Programming
 
Parallel programs to multi-processor computers!
Parallel programs to multi-processor computers!Parallel programs to multi-processor computers!
Parallel programs to multi-processor computers!
 
Concurrency and parallel in .net
Concurrency and parallel in .netConcurrency and parallel in .net
Concurrency and parallel in .net
 
Paper id 27201431
Paper id 27201431Paper id 27201431
Paper id 27201431
 
Android session-5-sajib
Android session-5-sajibAndroid session-5-sajib
Android session-5-sajib
 
BISSA: Empowering Web gadget Communication with Tuple Spaces
BISSA: Empowering Web gadget Communication with Tuple SpacesBISSA: Empowering Web gadget Communication with Tuple Spaces
BISSA: Empowering Web gadget Communication with Tuple Spaces
 
NoSQLEU: Different NoSQL tools in Production
NoSQLEU: Different NoSQL tools in ProductionNoSQLEU: Different NoSQL tools in Production
NoSQLEU: Different NoSQL tools in Production
 
wire-all-the-things-lambda-days-2023.pdf
wire-all-the-things-lambda-days-2023.pdfwire-all-the-things-lambda-days-2023.pdf
wire-all-the-things-lambda-days-2023.pdf
 

Último

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 

Último (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

Adventures building 3 realtime single-page apps 6 different ways

Notas del editor

  1. I’m Henrik Joreteg\nI’m one of the owners at &yet\n\nWe love building realtime web apps, which is why we decided to put on this conference.\n\nI’ve written a lot of javascript on several apps we’ve shipped in the last year or so. I’m gonna talk a bit about what we’ve learned.\n
  2. The three apps i’m gonna talk about are:\n
  3. \n
  4. Here’s what it looks like, queue of people waiting on the left, internal chat on the right, active chats in windows in the middle.\n
  5. \n
  6. \n
  7. Observable models are absolutely a necessity for building complex client-side apps. \n\nEspecially when you expect things to happen without user interaction.\n\nJS is great at events, use an evented model system, such as backbone. \n\nYour HTML should just respond to changes in your models, not the other way around.\n
  8. People talk a lot about loading pages as quickly as possible on the web.\n\nThis certainly isn’t quite as big of a deal with a single page app, where you load it once, and then keep it there.\n\nHowever, having to auth the browser session, create the page, and then then re-authenticate with XMPP is a bit on the slow side.\n
  9. Also, for any custom pubsub stuff you end up writing a plugin layer to parse the XML just to get it to a state where your app has the info it needs.\n\nThere are other solutions where you do a bit more of that logic on the server and you can start with info you need in form that’s easier to deal with.\n
  10. The second case it Recon Dynamics\n
  11. Very complex single page app, lots of items on the page. \n\nLive, asset tracking system, like something out of a spy movie. \n\nThey have this amazing, incredibly accurate hardware, with great battery life. \n\nWith the app you can draw geofences and get various types of alerts, really cool, stuff.\n\nThey are currently launched and live in Boise. \n
  12. \n
  13. One of the biggest challenges with this app was the fact that not everything was live. \n\nSo we have a job system that is processing incoming data and dumping it into a normal relational database.\n\nMixed sources of state proved a bit challenging.\n\nSo, we use kind of a traditional ajax approach to get *most* of the data. But as a user filters down the lists of assets they care about. We then subscribe to the live updates for those assets. \n\nIt works, but despite a unified model system, having updates from multiple data sources certainly complicated things.\n
  14. When you’ve got a dataset bigger than you want to ship to the client all at once you need a way to selectively retrieve and subscribe to updates for the items you care about.\n\n\n
  15. A browser can handle a pretty significant amount of data, but it doesn’t makes sense to send a ton of stuff if it’s not being used. Also, a lot of the things we care about as being “live” just become a historical log. \n\nThose logs don’t need to be “live” for ever. \n\nHaving a means of retrieving the history is good. \n\nAnalyze your data and chose what you’re willing to ship the browser at once, what actually needs to be “live” and what just needs to be retrievable somehow.\n
  16. The third app is &!\n
  17. \n
  18. \n
  19. I wrote a little tool called Capsule.js, that lets you mirror the state of things on the client and the server.\n\nEssentially, this lets you quickly prototype a realtime app without really having to build a solid, scalable server infrastructure.\n\nBUT... it’s not very secure or scaleable, but it can buy you some agility while you’re still figuring out what models you actually need.\n
  20. This is a big one... \n\nYou can use Redis as shared memory between processes or platforms. \n\nIf you interact with Redis according to a defined set of rules, you can essentially use it as your go-between for different processes.\n\nUnlike building something that just stores models in memory on the server redis can scale quite well.\n
  21. For that, we use Thoonk.\n\nThoonk is essentially a contract for how a library should interract with redis. It was written by Nathan Fritz and Lance Stout from our team. \n\nThere are currently implementations for node and Python.\n
  22. We use thoonk like an evented database. Essentially what you would normally put into a table in a relational database, becomes a “feed” in thoonk.\n\nBut unlike a database table, you can subscribe to a feed and be notified of changes.\n\n\n
  23. This is the real magic....\n\nChanges to thoonk, *FROM ANYWHERE* will get pushed all the way out to the browser.\n\nWe can write a worker in “C” that every 20 minutes runs a job that pulls active users on a team and publishes their status to the group. Or a bot that plops in the weather every morning.\n
  24. Each collection of models has a corresponding feed in Thoonk\n
  25. THOONK also has a job queue system.\n\nSo, as we’re building the API for &! rather than just tell other services to modify things in thoonk, we actually have a job system that handles any application logic and performs any related operations.\n\nFor example, if you delete a task from andbang, that’s currently marked as the task you’re working on, we need to update the user model so it doesn’t show the user as still working on a task.\n\nSo, anything we build on top of &! will just add jobs to the job system. Thoonk handles the rest.\n
  26. We still use Capsule models on the server as a way to encapsulate and re-use model-level behavior. \n\nFor example, determining whether a user is allowed to edit a model. We run the same permission check to know whether to display the form that lets them edit something in the interface of the app, as we do to actually determine whether they’re allowed to do it when a job comes through the job system.\n\nWe grab the models’s attributes from our thoonk feed, inflate our model and run that permission check. \n\nThat’s a simple example where you don’t gain that much, but as your app grows its really nice to be able to keep all that logic in one place.\n
  27. \n
  28. Capsule imports the nested data structure it receives and the views react and draw the app.\n
  29. As the user clicks, navigates and modifies data. RPC calls for those actions are sent to the server.\n
  30. The server validates the rpc call, tacks on the currently logged in user and adds it to the corresponding job queue.\n
  31. Workers take jobs and retrieve any models it needs from other feeds, checks permissions or does other conditional logic by inflating models and running methods on them. \n\nModified objects are written back to thoonk feeds.\n
  32. From the there pub-sub system takes over.\n\nChanges are propagated by redis to any subscribed thoonk clients. In our case on whatever node process got it.\n
  33. Those are shipped to the client with socket.io where they’re applied and the UI reacts.\n\nIt may sound a bit arduous, but it works, and it’s quick. We can also add as many worker processes as our scaling needs increase.\n\nSo, now for the fun stuff...\n
  34. \n
  35. Thank you very much!\n