Tus.io presentation for iOS devscout meetup

Preview:

DESCRIPTION

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

Citation preview

Khang Toh @khangtoh

About me• Developer, designer, thinker and entrepreneur

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

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

What do you do as an entrepreneur?

You think of ideas

You see funny cats pics at work

Sometimes you get bored and google for funny cats at

work

Then all the sudden, you have an awesome idea

Catstagram!User Generated Funny Cat

Pics and Videos!

Shot using their mobile phone camera!

Using the Catstagram app!

MVP Development 101

• Wrote server code

• Wrote iOS code

• Wrote server code

• Wrote iOS code

Problem

How to do file upload on mobile?

How to do file upload on mobile?

How to do file upload on mobile?

How to do file upload on mobile?

SUCKY SG MOBILE NETWORK

How to do RESUMABLE file upload on mobile?

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?

Then you google like every developer

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

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

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

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

What is the TUS protocol?

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

RESPONSE:

HTTP/1.1 200 OkOffset: 70

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

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

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

Where to find more info

• Official site http://tus.io

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

• IRC: #tusio freenode

• Duh... It's open source

Demo

Questions?