SlideShare a Scribd company logo
Designing and Debugging
Mobile Apps with an Embedded,
Scriptable Web Server
Matthew Burke

matthew.burke@capitalone.com

All Things Open • Raleigh, NC • 14 October 2019
Just a taste of why you might want to do this and how you would do it.

Reach out to me via email and I’d be happy to discuss at length
General Points
• Value in a general-purpose, turn-key solution?

• Easy enough to role your own

• Security

• Increases attack surface for your app

• Do you trust your beta testers?
Use Case 1:
Debugging
How easily can you expose your app’s
data structures and configuration?
Can do “simple” logging.

Also can do more targeted analysis
Use Case 2: Mocking
Two different scenarios for mocking:

1. Controlled testing

2. Backend doesn’t exist
Desired Operations
• CRUD
• list
• dump/load
• collect statistics
C reate

R ead

U pdate

D elete
Desired Features
• Path variables
• Header processing
• URL-encoded Forms
Others are context dependent. 

Unless you have specific needs, HTTPS support not needed.
Use Case 3: Tuning
CGFloat animationDuration = 0.5;
Or should it be 0.4, or 0.3 or …
KA SwiftTweaks
public struct ET: TweakLibraryType {
public static let tint = Tweak(“General”, “Colors”,
“Tint”, UIColor.blue)
public static let marginVertical = Tweak<CGFloat>(…
public static let defaultStore: TweakStore = …
Note one alternative with some history behind it is a “Tweaking system”

E.G. Kahn Academy’s implementation. Mention Facebook.

A lot of overhead due to creating UI to adjust these values.
Be careful with your UI.
Users will always
surprise you.
TAP Congress story
Use Case 3a: A/B
Testing
Use Case 4: 

Server App Port
Mobile OS
Application Application
Server OS
Shim
Implementation Notes
1: Web Server
• A number of drop-in alternatives exist:

• Swifter: https://github.com/httpswift/swifter (iOS)

• NanoHTTPD: https://github.com/NanoHttpd/nanohttpd
(Android)
server[“/app-auth-token”] = { _ in
let aaToken = self.appSession.appAuthToken ?? “N/A”
return aaToken
}
server[“/showmarked”] = { _ in
guard let mainView = …
let markedView = mainView.viewWithTag(tagMark)
markedView?.backgroundColor = .red
return .ok(.text(“markedn”)
}
server[“/register”] = { request in
guard let method = request.params[“method”] else
guard let path = request.params[“path”] else { …
guard let script = request.params[“script”] else {
self.server.router.register(method, path, script)
}
Implementation Notes
2: Scripting Engine
A few words about
Lua
Language choice: you want something light-weight and with a good API
Again, this is not necessarily production-quality code, although depending on your use case, it might be adequate.

The main point here is that Lua's first-class functions allow you to fairly easily implement a range of techniques.
smt = debug.getmetatable(“some string”)
smt.__mul = function(s, i)
local result = “”
for idx = 1, i do
result = result .. s
end
end
“foo” * 3 .. “bar” -- foofoofoobar
Perhaps a slightly less whimsical example...here I overload multiplication to give string repetition.
The Lua C API:
• fully re-entrant
• information contained in a Lua State
• communicate via a virtual stack of Lua values
• registry—predefined Lua table
• userdata for accessing host program data
“C API Details” Slide
C Binding
“C Binding Title” Slide
“Blink Photo” Slide
“Blink Implementation 1” Slide
“Blink Implementation 2” Slide
“Blink Implementation 3” Slide
“Blink Implementation 4” Slide
Summary
• Embedding a webserver during development opens up a
range of techniques to ease development and explore the
design space

• Scripting naturally extends this capability—you don’t have
to decide everything up front

• Lua is a very solid choice for this purpose.
Thank You! Questions?
• matthew.burke@capitalone.com

• http://github.com/profburke — slides will go up soonish
• http://lua.org

More Related Content

PPTX
Cleaner Code Through Test-Driven Development
PPTX
Modern Tools for Building Progressive Web Apps
PDF
Deploying Anything as a Service (XaaS) Using Operators on Kubernetes
PDF
Serverless Functions: Accelerating DevOps Adoption
PDF
Embracing Observability in CI/CD with OpenTelemetry
PPTX
Serverless
PDF
Is your kubernetes negative or positive
PDF
Microservice no fluff, the REAL stuff
Cleaner Code Through Test-Driven Development
Modern Tools for Building Progressive Web Apps
Deploying Anything as a Service (XaaS) Using Operators on Kubernetes
Serverless Functions: Accelerating DevOps Adoption
Embracing Observability in CI/CD with OpenTelemetry
Serverless
Is your kubernetes negative or positive
Microservice no fluff, the REAL stuff

What's hot (17)

PDF
Netflix Architecture and Open Source
PPTX
Better java with design
PPTX
Javascript Frameworks (and How to Learn Them)
PPTX
Devops online training ppt
PPTX
Serverless meetup - OpenWhisk overview and architecture
PPTX
How to practice TDD without shooting yourself in the foot
PDF
Securing Your Resources with Short-Lived Certificates!
PPTX
Continuous integration
PDF
Flux is incubating + the road ahead
PPTX
Infrastrucutre as Code
PPTX
Tce automation-d4
PDF
Go for Operations
PPTX
DevOps from the Provider Perspective
PDF
Who needs containers in a serverless world
PDF
Javantura v4 - Support SpringBoot application development lifecycle using Ora...
PPTX
GraphQL-ify your APIs
PDF
Integracia security do ci cd pipelines
Netflix Architecture and Open Source
Better java with design
Javascript Frameworks (and How to Learn Them)
Devops online training ppt
Serverless meetup - OpenWhisk overview and architecture
How to practice TDD without shooting yourself in the foot
Securing Your Resources with Short-Lived Certificates!
Continuous integration
Flux is incubating + the road ahead
Infrastrucutre as Code
Tce automation-d4
Go for Operations
DevOps from the Provider Perspective
Who needs containers in a serverless world
Javantura v4 - Support SpringBoot application development lifecycle using Ora...
GraphQL-ify your APIs
Integracia security do ci cd pipelines
Ad

Similar to Designing and Debugging Mobile Apps with an Embedded, Scriptable Web Server (20)

DOC
Qtp interview questions
DOC
Qtp interview questions
PDF
Cloud APIs Overview Tucker
PPTX
Browser-Based Load Testing with Grafana K6
DOC
Divya Jyothi Resume
ODP
Boost your App with Gatling
PPT
Justmeans power point
PPT
First QTP Tutorial
PPT
QTP Tutorial Slides Presentation.
PPT
Dhanasekaran 2008-2009 Quick Test Pro Presentation
PPTX
Optimization and fault tolerance in distributed transaction with Node.JS Grap...
PPTX
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
PPTX
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
PPT
Multi-tenancy with Rails
PPTX
Cucumber_Training_ForQA
PDF
Serverless Computing
PPT
Struts 2-overview2
PPT
Developing Java Web Applications In Google App Engine
PDF
Gatling Performance Workshop
Qtp interview questions
Qtp interview questions
Cloud APIs Overview Tucker
Browser-Based Load Testing with Grafana K6
Divya Jyothi Resume
Boost your App with Gatling
Justmeans power point
First QTP Tutorial
QTP Tutorial Slides Presentation.
Dhanasekaran 2008-2009 Quick Test Pro Presentation
Optimization and fault tolerance in distributed transaction with Node.JS Grap...
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
Multi-tenancy with Rails
Cucumber_Training_ForQA
Serverless Computing
Struts 2-overview2
Developing Java Web Applications In Google App Engine
Gatling Performance Workshop
Ad

More from All Things Open (20)

PDF
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
PPTX
Big Data on a Small Budget: Scalable Data Visualization for the Rest of Us - ...
PDF
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
PDF
Let's Create a GitHub Copilot Extension! - Nick Taylor, Pomerium
PDF
Leveraging Pre-Trained Transformer Models for Protein Function Prediction - T...
PDF
Gen AI: AI Agents - Making LLMs work together in an organized way - Brent Las...
PDF
You Don't Need an AI Strategy, But You Do Need to Be Strategic About AI - Jes...
PPTX
DON’T PANIC: AI IS COMING – The Hitchhiker’s Guide to AI - Mark Hinkle, Perip...
PDF
Fine-Tuning Large Language Models with Declarative ML Orchestration - Shivay ...
PDF
Leveraging Knowledge Graphs for RAG: A Smarter Approach to Contextual AI Appl...
PPTX
Artificial Intelligence Needs Community Intelligence - Sriram Raghavan, IBM R...
PDF
Don't just talk to AI, do more with AI: how to improve productivity with AI a...
PPTX
Open-Source GenAI vs. Enterprise GenAI: Navigating the Future of AI Innovatio...
PDF
The Death of the Browser - Rachel-Lee Nabors, AgentQL
PDF
Making Operating System updates fast, easy, and safe
PDF
Reshaping the landscape of belonging to transform community
PDF
The Unseen, Underappreciated Security Work Your Maintainers May (or may not) ...
PDF
Integrating Diversity, Equity, and Inclusion into Product Design
PDF
The Open Source Ecosystem for eBPF in Kubernetes
PDF
Open Source Privacy-Preserving Metrics - Sarah Gran & Brandon Pitman
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
Big Data on a Small Budget: Scalable Data Visualization for the Rest of Us - ...
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
Let's Create a GitHub Copilot Extension! - Nick Taylor, Pomerium
Leveraging Pre-Trained Transformer Models for Protein Function Prediction - T...
Gen AI: AI Agents - Making LLMs work together in an organized way - Brent Las...
You Don't Need an AI Strategy, But You Do Need to Be Strategic About AI - Jes...
DON’T PANIC: AI IS COMING – The Hitchhiker’s Guide to AI - Mark Hinkle, Perip...
Fine-Tuning Large Language Models with Declarative ML Orchestration - Shivay ...
Leveraging Knowledge Graphs for RAG: A Smarter Approach to Contextual AI Appl...
Artificial Intelligence Needs Community Intelligence - Sriram Raghavan, IBM R...
Don't just talk to AI, do more with AI: how to improve productivity with AI a...
Open-Source GenAI vs. Enterprise GenAI: Navigating the Future of AI Innovatio...
The Death of the Browser - Rachel-Lee Nabors, AgentQL
Making Operating System updates fast, easy, and safe
Reshaping the landscape of belonging to transform community
The Unseen, Underappreciated Security Work Your Maintainers May (or may not) ...
Integrating Diversity, Equity, and Inclusion into Product Design
The Open Source Ecosystem for eBPF in Kubernetes
Open Source Privacy-Preserving Metrics - Sarah Gran & Brandon Pitman

Recently uploaded (20)

PPT
Teaching material agriculture food technology
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Cloud computing and distributed systems.
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Empathic Computing: Creating Shared Understanding
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Spectroscopy.pptx food analysis technology
PDF
Machine learning based COVID-19 study performance prediction
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Electronic commerce courselecture one. Pdf
PDF
KodekX | Application Modernization Development
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Teaching material agriculture food technology
Encapsulation_ Review paper, used for researhc scholars
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
“AI and Expert System Decision Support & Business Intelligence Systems”
Building Integrated photovoltaic BIPV_UPV.pdf
Cloud computing and distributed systems.
Diabetes mellitus diagnosis method based random forest with bat algorithm
Empathic Computing: Creating Shared Understanding
Mobile App Security Testing_ A Comprehensive Guide.pdf
cuic standard and advanced reporting.pdf
Network Security Unit 5.pdf for BCA BBA.
Per capita expenditure prediction using model stacking based on satellite ima...
Review of recent advances in non-invasive hemoglobin estimation
Spectroscopy.pptx food analysis technology
Machine learning based COVID-19 study performance prediction
Unlocking AI with Model Context Protocol (MCP)
Dropbox Q2 2025 Financial Results & Investor Presentation
Electronic commerce courselecture one. Pdf
KodekX | Application Modernization Development
How UI/UX Design Impacts User Retention in Mobile Apps.pdf

Designing and Debugging Mobile Apps with an Embedded, Scriptable Web Server

  • 1. Designing and Debugging Mobile Apps with an Embedded, Scriptable Web Server Matthew Burke matthew.burke@capitalone.com All Things Open • Raleigh, NC • 14 October 2019 Just a taste of why you might want to do this and how you would do it. Reach out to me via email and I’d be happy to discuss at length
  • 2. General Points • Value in a general-purpose, turn-key solution? • Easy enough to role your own • Security • Increases attack surface for your app • Do you trust your beta testers?
  • 4. How easily can you expose your app’s data structures and configuration? Can do “simple” logging. Also can do more targeted analysis
  • 5. Use Case 2: Mocking Two different scenarios for mocking: 1. Controlled testing 2. Backend doesn’t exist
  • 6. Desired Operations • CRUD • list • dump/load • collect statistics C reate R ead U pdate D elete
  • 7. Desired Features • Path variables • Header processing • URL-encoded Forms Others are context dependent. Unless you have specific needs, HTTPS support not needed.
  • 8. Use Case 3: Tuning
  • 9. CGFloat animationDuration = 0.5; Or should it be 0.4, or 0.3 or …
  • 10. KA SwiftTweaks public struct ET: TweakLibraryType { public static let tint = Tweak(“General”, “Colors”, “Tint”, UIColor.blue) public static let marginVertical = Tweak<CGFloat>(… public static let defaultStore: TweakStore = … Note one alternative with some history behind it is a “Tweaking system” E.G. Kahn Academy’s implementation. Mention Facebook. A lot of overhead due to creating UI to adjust these values.
  • 11. Be careful with your UI. Users will always surprise you. TAP Congress story
  • 12. Use Case 3a: A/B Testing
  • 13. Use Case 4: 
 Server App Port
  • 16. • A number of drop-in alternatives exist: • Swifter: https://github.com/httpswift/swifter (iOS) • NanoHTTPD: https://github.com/NanoHttpd/nanohttpd (Android)
  • 17. server[“/app-auth-token”] = { _ in let aaToken = self.appSession.appAuthToken ?? “N/A” return aaToken }
  • 18. server[“/showmarked”] = { _ in guard let mainView = … let markedView = mainView.viewWithTag(tagMark) markedView?.backgroundColor = .red return .ok(.text(“markedn”) }
  • 19. server[“/register”] = { request in guard let method = request.params[“method”] else guard let path = request.params[“path”] else { … guard let script = request.params[“script”] else { self.server.router.register(method, path, script) }
  • 21. A few words about Lua Language choice: you want something light-weight and with a good API
  • 22. Again, this is not necessarily production-quality code, although depending on your use case, it might be adequate. The main point here is that Lua's first-class functions allow you to fairly easily implement a range of techniques.
  • 23. smt = debug.getmetatable(“some string”) smt.__mul = function(s, i) local result = “” for idx = 1, i do result = result .. s end end “foo” * 3 .. “bar” -- foofoofoobar Perhaps a slightly less whimsical example...here I overload multiplication to give string repetition.
  • 24. The Lua C API: • fully re-entrant • information contained in a Lua State • communicate via a virtual stack of Lua values • registry—predefined Lua table • userdata for accessing host program data “C API Details” Slide
  • 25. C Binding “C Binding Title” Slide
  • 31. Summary • Embedding a webserver during development opens up a range of techniques to ease development and explore the design space • Scripting naturally extends this capability—you don’t have to decide everything up front • Lua is a very solid choice for this purpose.
  • 32. Thank You! Questions? • matthew.burke@capitalone.com • http://github.com/profburke — slides will go up soonish • http://lua.org