27
Khang Toh @khangtoh

Tus.io presentation for iOS devscout meetup

Embed Size (px)

DESCRIPTION

A brief introduction to TUS an open protocol for resumable file upload.

Citation preview

Page 1: Tus.io presentation for  iOS devscout meetup

Khang Toh @khangtoh

Page 2: Tus.io presentation for  iOS devscout meetup

About me• Developer, designer, thinker and entrepreneur

• Co-Founder / CTO at MogiMe Inc, San Francisco and PicoCandy Singapore :)

Page 3: Tus.io presentation for  iOS devscout meetup

My iOS Story

• Bought iPhone 1st gen in 2008. Started playing with iphone sdk 2.0

• Developed first iOS game, smackBOTS using UIKit !!??!!, 500K downloads in the first month, Top100 Overall

• First PvP multiplayer iOS game, super hackery implementation in 2009

• Partied with the Woz at WWDC2009

• Aspired to be an entrepreneur

Page 4: Tus.io presentation for  iOS devscout meetup

What do you do as an entrepreneur?

Page 5: Tus.io presentation for  iOS devscout meetup

You think of ideas

Page 6: Tus.io presentation for  iOS devscout meetup

You see funny cats pics at work

Sometimes you get bored and google for funny cats at

work

Page 7: Tus.io presentation for  iOS devscout meetup

Then all the sudden, you have an awesome idea

Page 8: Tus.io presentation for  iOS devscout meetup

Catstagram!User Generated Funny Cat

Pics and Videos!

Shot using their mobile phone camera!

Using the Catstagram app!

Page 9: Tus.io presentation for  iOS devscout meetup

MVP Development 101

• Wrote server code

• Wrote iOS code

• Wrote server code

• Wrote iOS code

Page 10: Tus.io presentation for  iOS devscout meetup

Problem

How to do file upload on mobile?

Page 11: Tus.io presentation for  iOS devscout meetup

How to do file upload on mobile?

Page 12: Tus.io presentation for  iOS devscout meetup

How to do file upload on mobile?

Page 13: Tus.io presentation for  iOS devscout meetup

How to do file upload on mobile?

SUCKY SG MOBILE NETWORK

Page 14: Tus.io presentation for  iOS devscout meetup

How to do RESUMABLE file upload on mobile?

Page 15: Tus.io presentation for  iOS devscout meetup

It's possible, but way too hard for a mobile-first and cats-focus

startup

• Flash?? Not possible + it sucks.

• HTML5 ?? Not great on mobile safari

• Native?? AFNetworking? HTTP?

Page 16: Tus.io presentation for  iOS devscout meetup

Then you google like every developer

Page 17: Tus.io presentation for  iOS devscout meetup

TUS.IO a resumable file upload protocol on top of HTTP

Page 18: Tus.io presentation for  iOS devscout meetup

What is the TUS protocol?

• Simple, open and free

• HTTP-based ( POST, HEAD, PATCH )

• Split file into chunks

• Send smaller pieces, server keeps track of chunks / offset

Page 19: Tus.io presentation for  iOS devscout meetup

What is the TUS protocol?

POST "/files" HTTP/1.1Host: tus.example.orgContent-Length: 0Final-Length: 100

RESPONSE:

HTTP/1.1 201 CreatedLocation: http://tus.example.org/files/1

Page 20: Tus.io presentation for  iOS devscout meetup

What is the TUS protocol?

PATCH "/files/1" HTTP/1.1Host: tus.example.orgContent-Length: 100Offset: 0[file data]

RESPONSE:

HTTP/1.1 200 Ok

Page 21: Tus.io presentation for  iOS devscout meetup

What is the TUS protocol?

HEAD "/files/1" HTTP/1.1Host: tus.example.org

RESPONSE:

HTTP/1.1 200 OkOffset: 70

Page 22: Tus.io presentation for  iOS devscout meetup

What is the TUS protocol?

PATCH "/files/1" HTTP/1.1Host: tus.example.orgContent-Length: 30Offset: 70

[remaining file data]

RESPONSE:

HTTP/1.1 200 Ok

Page 23: Tus.io presentation for  iOS devscout meetup

Awesome! What about the servers and the

clients?• tusd - reference server

implementation using Go

• tus-ios-client, native objective-C client library

• rubytus, ruby em-based server implementation, work in progress

Page 24: Tus.io presentation for  iOS devscout meetup

Use with caution

• Young protocol, 0.2.1, still changing

• New features in planning

• TUSKit - iOS client needs work, we're working on it

• Need more support from OSS

• RFC? Not ready but is the goal for the protocol

Probably ok for cat-focus mobile-first startups

Page 25: Tus.io presentation for  iOS devscout meetup

Where to find more info

• Official site http://tus.io

• Github: http://github.com/tus

• IRC: #tusio freenode

• Duh... It's open source

Page 26: Tus.io presentation for  iOS devscout meetup

Demo

Page 27: Tus.io presentation for  iOS devscout meetup

Questions?