Slide 1

Slide 1 text

Death, Taxes, and HTTP @JesseWilson @JakeWharton

Slide 2

Slide 2 text

You

Slide 3

Slide 3 text

Your Team

Slide 4

Slide 4 text

Client

Slide 5

Slide 5 text

Client

Slide 6

Slide 6 text

Client Server

Slide 7

Slide 7 text

Client Server

Slide 8

Slide 8 text

Client Server

Slide 9

Slide 9 text

Client Server

Slide 10

Slide 10 text

Client Server

Slide 11

Slide 11 text

Round-Trip Time Client Server

Slide 12

Slide 12 text

RTT Client Server

Slide 13

Slide 13 text

Client Server

Slide 14

Slide 14 text

Client Server GET / HTTP/1.1

Slide 15

Slide 15 text

Client Server GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 16

Slide 16 text

Client Server GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 17

Slide 17 text

Client Server GET / HTTP/1.1 HTTP/1.1 200 OK Transport Layer Security

Slide 18

Slide 18 text

Client Server GET / HTTP/1.1 HTTP/1.1 200 OK TLS

Slide 19

Slide 19 text

Client Server GET / HTTP/1.1 HTTP/1.1 200 OK TLS

Slide 20

Slide 20 text

Client Server TLS v1.2

Slide 21

Slide 21 text

Client Server TLS v1.2 U TLS?

Slide 22

Slide 22 text

Client Server TLS v1.2 Ya. Here's my cert.

Slide 23

Slide 23 text

Client Server TLS v1.2 Great. Key is hunter2

Slide 24

Slide 24 text

Client Server TLS v1.2 I'm ready!

Slide 25

Slide 25 text

Client Server TLS v1.2 GET / HTTP/1.1

Slide 26

Slide 26 text

Client Server TLS v1.2 GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 27

Slide 27 text

Client Server TLS v1.2 w/ session resumption GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 28

Slide 28 text

GET / HTTP/1.1 HTTP/1.1 200 OK Client Server TLS v1.2 w/ session resumption

Slide 29

Slide 29 text

Client Server TLS v1.2 w/ session resumption 3 GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 30

Slide 30 text

Client Server TLS v1.3

Slide 31

Slide 31 text

Client Server TLS v1.3 TLS? Key is hunter2

Slide 32

Slide 32 text

Client Server TLS v1.3 Ya. Here's my cert and key

Slide 33

Slide 33 text

Client Server TLS v1.3 Let's go!

Slide 34

Slide 34 text

Client Server TLS v1.3 GET / HTTP/1.1

Slide 35

Slide 35 text

Client Server TLS v1.3 GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 36

Slide 36 text

Client Server TLS v1.3 w/ session resumption GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 37

Slide 37 text

Client Server TLS v1.3 w/ 0-RTT session resumption

Slide 38

Slide 38 text

Client Server TLS v1.3 w/ 0-RTT session resumption

Slide 39

Slide 39 text

Client Server TLS v1.3 w/ 0-RTT session resumption GET / HTTP/1.1

Slide 40

Slide 40 text

Client Server TLS v1.3 w/ 0-RTT session resumption GET / HTTP/1.1

Slide 41

Slide 41 text

Client Server TLS v1.3 w/ 0-RTT session resumption GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 42

Slide 42 text

Client Server TLS v1.3 w/ 0-RTT session resumption GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 43

Slide 43 text

Client Server TLS v1.3 w/ 0-RTT session resumption GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 44

Slide 44 text

RTT TLS v1.3 w/ 0-RTT session resumption TLS v1.3 w/ session resumption TLS v1.3 TLS v1.2 w/ session resumption TLS v1.2 2 1 1 1 0

Slide 45

Slide 45 text

OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://twitter.com") .build(); Call call = client.newCall(request); Response response = call.execute(); System.out.println(response.handshake().tlsVersion());

Slide 46

Slide 46 text

OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://twitter.com") .build(); Call call = client.newCall(request); Response response = call.execute(); System.out.println(response.handshake().tlsVersion());

Slide 47

Slide 47 text

OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://twitter.com") .build(); Call call = client.newCall(request); Response response = call.execute(); System.out.println(response.handshake().tlsVersion()); TLS_1_2

Slide 48

Slide 48 text

HTTP Client Server GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 49

Slide 49 text

HTTP Client Server GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 50

Slide 50 text

HTTP Client Server GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 51

Slide 51 text

HTTP Client Server GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 52

Slide 52 text

HTTP Server Client GET /YHTTP/1.1 HTTP/1.1 200 OK

Slide 53

Slide 53 text

GET /YHTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"} HTTP

Slide 54

Slide 54 text

/Y /payments.html /profile.html /login.html /settings.html /static/fonts/roboto.ttf /static/js/app.js /static/css/main.css /static/image/logo.png

Slide 55

Slide 55 text

/Y /payments.html /profile.html /login.html /settings.html /static/fonts/roboto.ttf /static/js/app.js /static/css/main.css /static/image/logo.png /api/auth /api/user /api/payments /api/payments/1234 /api/settings

Slide 56

Slide 56 text

Server Client GET /api/payments HTTP/1.1 200 OK

Slide 57

Slide 57 text

Server Client GET /api/payments HTTP/1.1 200 OK

Slide 58

Slide 58 text

Server Client GET /api/payments HTTP/1.1 200 OK

Slide 59

Slide 59 text

Server Client GET /api/payments HTTP/1.1 200 OK

Slide 60

Slide 60 text

Server Client GET /api/payments HTTP/1.1 200 OK

Slide 61

Slide 61 text

Server Client GET /api/payments HTTP/1.1 200 OK

Slide 62

Slide 62 text

Server Client GET /api/payments HTTP/1.1 200 OK

Slide 63

Slide 63 text

.html

Slide 64

Slide 64 text

.js .html .js .js .js .js .js .js

Slide 65

Slide 65 text

.js .html .js .js .js .js .js .js .css .css .css .css

Slide 66

Slide 66 text

.js .html .js .js .js .js .js .js .png .png .png .png .png .png .png .png .css .css .css .css

Slide 67

Slide 67 text

.js .html .js .js .js .js .js .js .png .jpg .png .png .jpg .png .png .png .png .png .css .css .css .css

Slide 68

Slide 68 text

.js .html .js .js .js .js .js .js .png .jpg .png .png .jpg .png .png .png .png .png .css .css .css .css 22 requests

Slide 69

Slide 69 text

.js .html .js .js .js .js .js .js .png .jpg .png .png .jpg .png .png .png .png .png .css .css .css .css 16 requests

Slide 70

Slide 70 text

.js .html .png .jpg .png .png .jpg .png .png .png .png .png .css .css .css .css 13 requests

Slide 71

Slide 71 text

.js .html .png .jpg .png .png .jpg .png .css 6 requests .png .png .png .png

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

.js .html .png .jpg .png .png .jpg .png .css 6 requests .png .png .png .png

Slide 74

Slide 74 text

.js .html .jpg .jpg .png .css 1+3+2 requests example.com cdn.example.com images.example.com

Slide 75

Slide 75 text

.js .html .jpg .jpg .png .css example.com cdn.example.com images.example.com

Slide 76

Slide 76 text

.js .html .jpg .jpg .png .css example.com cdn.example.com images.example.com

Slide 77

Slide 77 text

.js .html .jpg .jpg .png .css example.com cdn.example.com images.example.com .jpg .jpg .jpg .jpg .jpg .jpg

Slide 78

Slide 78 text

.js .html .png .css example.com cdn.example.com images.example.com .jpg .jpg .jpg .jpg .jpg .jpg .jpg .jpg

Slide 79

Slide 79 text

.js .html .png .css example.com cdn.example.com images1.example.com .jpg .jpg .jpg .jpg .jpg .jpg .jpg .jpg images2.example.com

Slide 80

Slide 80 text

.js .html .png .css example.com cdn.example.com images1.example.com .jpg .jpg .jpg .jpg .jpg .jpg .jpg .jpg images2.example.com

Slide 81

Slide 81 text

Server Client GET /api/payments HTTP/1.1 200 OK

Slide 82

Slide 82 text

/api/payments [A 1234, 1275, 1690, 2641, 2903, 4991, 5312, 5319, 14328, 28321, 29948, 30991, 37174, 73572 ]B

Slide 83

Slide 83 text

/api/payments [A 1234, 1275, 1690, 2641, 2903, 4991, 5312, 5319, 14328, 28321, 29948, 30991, 37174, 73572 ]B /api/payments/{id} {C id: 1234, amount: 4200, currency: "USD", initiator_id:F48818374, recipient_id:G24567654, initiated_at: 14764993868, completed_at: 14769455213 },Z

Slide 84

Slide 84 text

/api/payments [A {C id: 1234, amount: 4200, currency: "USD", initiator:F{ id: 48818374, name: "Jake Wharton" }, recipient:G{ id: 24567654, name: "Jesse Wilson" }, initiated_at: 14764993868, completed_at: 14769455213 },Z ... /api/payments/{id} 1234 1275 1690, 2641, 2903, 4991, 5312, 5319, 14328,

Slide 85

Slide 85 text

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 86

Slide 86 text

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 87

Slide 87 text

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 88

Slide 88 text

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 89

Slide 89 text

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 90

Slide 90 text

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 91

Slide 91 text

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 92

Slide 92 text

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 93

Slide 93 text

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 94

Slide 94 text

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 95

Slide 95 text

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 96

Slide 96 text

HTTP/2 Client Server GET /api/payments?last=43163 HTTP/1.1 200 OK

Slide 97

Slide 97 text

HTTP/2 Client Server GET /api/payments?last=43163 HTTP/1.1 200 OK

Slide 98

Slide 98 text

HTTP/2 Client Server GET /api/payments?last=43163 HTTP/1.1 200 OK

Slide 99

Slide 99 text

HTTP/2 Client Server GET /api/payments?last=43163 HTTP/1.1 200 OK

Slide 100

Slide 100 text

HTTP/2 Client Server GET /api/payments?last=43163 HTTP/1.1 200 OK

Slide 101

Slide 101 text

HTTP/1.1 GET /api/payments?last=43163 HTTP/1.1 200 OK GET /api/payments HTTP/1.1 200 OK HTTP/2

Slide 102

Slide 102 text

HTTP/1.1 GET /api/payments?last=43163 HTTP/1.1 200 OK GET /api/payments HTTP/1.1 200 OK HTTP/2 time

Slide 103

Slide 103 text

GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"} HTTP/1.1 HTTP/2 GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"}

Slide 104

Slide 104 text

GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"} HTTP/1.1 HTTP/2 GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"}

Slide 105

Slide 105 text

GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"}

Slide 106

Slide 106 text

GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"}

Slide 107

Slide 107 text

GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"} ID: 2 ID: 2

Slide 108

Slide 108 text

GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"} ID: 2 ID: 2 GET /api/payments HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4

Slide 109

Slide 109 text

GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"} ID: 2 ID: 2 GET /api/payments HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4

Slide 110

Slide 110 text

GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"} ID: 2 ID: 2 GET /api/payments HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4

Slide 111

Slide 111 text

GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT {"id":1234,"amount":4200,"currency":"USD"} ID: 2 ID: 2

Slide 112

Slide 112 text

GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 {"id":1234,"amount":4200,"currency":"USD"} ID: 2

Slide 113

Slide 113 text

GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2

Slide 114

Slide 114 text

GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 {"id":1234,"amount":420 ID: 2 [1234,1275,1690,2641,2903,49 ID: 4

Slide 115

Slide 115 text

GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2

Slide 116

Slide 116 text

GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4

Slide 117

Slide 117 text

GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4

Slide 118

Slide 118 text

GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4

Slide 119

Slide 119 text

GET / HTTP/1.1 0x25: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4

Slide 120

Slide 120 text

GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4

Slide 121

Slide 121 text

GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4

Slide 122

Slide 122 text

GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4

Slide 123

Slide 123 text

GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4

Slide 124

Slide 124 text

GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4

Slide 125

Slide 125 text

GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4

Slide 126

Slide 126 text

GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4

Slide 127

Slide 127 text

Client Server GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 2 HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 ID: 4

Slide 128

Slide 128 text

Client Server GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 2 HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 ID: 4

Slide 129

Slide 129 text

Client Server HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 HTTP/1.1 200 OK 0x1E: application/json 0x1B: 471 0x21: "ae7284b30ccc93" 0x2B: Wed, 19 Apr 2017 09:22:09 GMT ID: 4

Slide 130

Slide 130 text

Client Server HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 HTTP/1.1 200 OK 0x1E: application/json 0x1B: 471 0x21: "ae7284b30ccc93" 0x2B: Wed, 19 Apr 2017 09:22:09 GMT ID: 4

Slide 131

Slide 131 text

Client Server 0x08 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 0x08 0x1E: application/json 0x1B: 471 0x21: "ae7284b30ccc93" 0x2B: Wed, 19 Apr 2017 09:22:09 GMT ID: 4

Slide 132

Slide 132 text

Client Server 0x08 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 0x08 0x1E: 0x1A 0x1B: 471 0x21: "ae7284b30ccc93" 0x2B: Wed, 19 Apr 2017 09:22:09 GMT ID: 4

Slide 133

Slide 133 text

Client Server 0x08 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 0x08 0x1E: 0x1A 0x1B: 471 0x21: "ae7284b30ccc93" 0x2B: Wed, 19 Apr 2017 09:22:09 GMT ID: 4

Slide 134

Slide 134 text

Client Server ID: 2 GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 2 0x08 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 4 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 ID: 4 0x08 0x1E: 0x1A 0x1B: 471 0x21: "ae7284b30ccc93" 0x2B: Wed, 19 Apr 2017 09:22:09 GMT

Slide 135

Slide 135 text

OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://twitter.com") .build(); Call call = client.newCall(request); Response response = call.execute(); System.out.println(response.protocol());

Slide 136

Slide 136 text

OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://twitter.com") .build(); Call call = client.newCall(request); Response response = call.execute(); System.out.println(response.protocol());

Slide 137

Slide 137 text

OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://twitter.com") .build(); Call call = client.newCall(request); Response response = call.execute(); System.out.println(response.protocol()); h2

Slide 138

Slide 138 text

Payloads {"id":1234,"amount":4200,"currency":"USD"}

Slide 139

Slide 139 text

{"id":1234,"amount":4200,"currency":"USD"} JSON

Slide 140

Slide 140 text

{"id":1234,"amount":4200,"currency":"USD"} JSON message Payment { string id = 1; int32 amount = 2; Currency currency = 3; } enum Currency { USD = 1; } Protocol Buffers

Slide 141

Slide 141 text

{"id":1234,"amount":4200,"currency":"USD"} JSON message Payment { string id = 1; int32 amount = 2; Currency currency = 3; } enum Currency { USD = 1; } Protocol Buffers 1=1234 2=4200 3=1

Slide 142

Slide 142 text

{"id":1234,"amount":4200,"currency":"USD"} JSON message Payment { string id = 1; int32 amount = 2; Currency currency = 3; } enum Currency { USD = 1; } Protocol Buffers 1=1234 2=4200 3=1 0104D20210680301

Slide 143

Slide 143 text

{"id":1234,"amount":4200,"currency":"USD"} JSON message Payment { string id = 1; int32 amount = 2; Currency currency = 3; } enum Currency { USD = 1; } Protocol Buffers

Slide 144

Slide 144 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y

Slide 145

Slide 145 text

Y{ "id":1234, "amount":4200, "currency":"USD" }Y

Slide 146

Slide 146 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y

Slide 147

Slide 147 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y

Slide 148

Slide 148 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y

Slide 149

Slide 149 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y

Slide 150

Slide 150 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y id

Slide 151

Slide 151 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y String(id)

Slide 152

Slide 152 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y String(id) Map>

Slide 153

Slide 153 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y String(id) Map> Adapter

Slide 154

Slide 154 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y String(id) Map> Adapter

Slide 155

Slide 155 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y String(id) Map> Adapter

Slide 156

Slide 156 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y String(id) Map> Adapter 1234L

Slide 157

Slide 157 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L

Slide 158

Slide 158 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L

Slide 159

Slide 159 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L

Slide 160

Slide 160 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L

Slide 161

Slide 161 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L String(amount)

Slide 162

Slide 162 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L String(amount) Map>

Slide 163

Slide 163 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L String(amount) Map> Adapter

Slide 164

Slide 164 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L String(amount) Map> Adapter

Slide 165

Slide 165 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L String(amount) Map> Adapter

Slide 166

Slide 166 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L String(amount) Map> Adapter 4200L

Slide 167

Slide 167 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L 4200L

Slide 168

Slide 168 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L 4200L

Slide 169

Slide 169 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L 4200L

Slide 170

Slide 170 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L 4200L

Slide 171

Slide 171 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L String(currency) 4200L

Slide 172

Slide 172 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L String(currency) Map> 4200L

Slide 173

Slide 173 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L String(currency) Map> Adapter 4200L

Slide 174

Slide 174 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L String(currency) Map> Adapter 4200L

Slide 175

Slide 175 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L String(currency) Map> 4200L Adapter

Slide 176

Slide 176 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L String(currency) Map> 4200L 4200L Adapter CurrencyCode.USD

Slide 177

Slide 177 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L 4200L CurrencyCode.USD

Slide 178

Slide 178 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L 4200L CurrencyCode.USD

Slide 179

Slide 179 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y 1234L 4200L CurrencyCode.USD

Slide 180

Slide 180 text

[ Y{"id":1234,"amount":4200,"currency":"USD"},Y {"id":1275,"amount":10000,"currency":"USD"}, {"id":1690,"amount":834,"currency":"USD"}, {"id":2641,"amount":2448,"currency":"USD"}, {"id":2903,"amount":11305,"currency":"USD"}, {"id":4991,"amount":566,"currency":"USD"}, {"id":5312,"amount":702,"currency":"USD"}, {"id":5319,"amount":3885,"currency":"USD"}, {"id":14328,"amount":34400,"currency":"USD"}, {"id":28321,"amount":892,"currency":"USD"}, {"id":29948,"amount":2261,"currency":"USD"}, {"id":30991,"amount":6600,"currency":"USD"}, {"id":37174,"amount":939,"currency":"USD"}, {"id":73572,"amount":40000,"currency":"USD"} ]

Slide 181

Slide 181 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y

Slide 182

Slide 182 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y ByteString("amount") ByteString("currency") ByteString("id")

Slide 183

Slide 183 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y ByteString("amount") ByteString("currency") ByteString("id")

Slide 184

Slide 184 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y ByteString("amount") ByteString("currency") ByteString("id")

Slide 185

Slide 185 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y ByteString("amount") ByteString("currency") ByteString("id")

Slide 186

Slide 186 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y ByteString("amount") ByteString("currency") ByteString("id")

Slide 187

Slide 187 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y ByteString("amount") ByteString("currency") ByteString("id")

Slide 188

Slide 188 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y ByteString("amount") ByteString("currency") ByteString("id")

Slide 189

Slide 189 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y ByteString("amount") ByteString("currency") ByteString("id")

Slide 190

Slide 190 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y ByteString("amount") ByteString("currency") ByteString("id") Adapter Adapter Adapter

Slide 191

Slide 191 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y ByteString("amount") ByteString("currency") ByteString("id") Adapter Adapter Adapter

Slide 192

Slide 192 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y ByteString("amount") ByteString("currency") ByteString("id") Adapter Adapter Adapter

Slide 193

Slide 193 text

Y{"id":1234,"amount":4200,"currency":"USD"}Y ByteString("amount") ByteString("currency") ByteString("id") Adapter Adapter Adapter Adapter

Slide 194

Slide 194 text

[ Y{"id":1234,"amount":4200,"currency":"USD"},Y {"id":1275,"amount":10000,"currency":"USD"}, {"id":1690,"amount":834,"currency":"USD"}, {"id":2641,"amount":2448,"currency":"USD"}, {"id":2903,"amount":11305,"currency":"USD"}, {"id":4991,"amount":566,"currency":"USD"}, {"id":5312,"amount":702,"currency":"USD"}, {"id":5319,"amount":3885,"currency":"USD"}, {"id":14328,"amount":34400,"currency":"USD"}, ByteString("amount") ByteString("currency") ByteString("id") Adapter Adapter Adapter Adapter

Slide 195

Slide 195 text

github.com/square/moshi

Slide 196

Slide 196 text

WebSocket Client Server

Slide 197

Slide 197 text

WebSocket Client Server GET / HTTP/1.1 Sprechen sie websocket?

Slide 198

Slide 198 text

WebSocket Client Server GET / HTTP/1.1 HTTP/1.1 101 ¡Sí!

Slide 199

Slide 199 text

WebSocket Client Server GET / HTTP/1.1 HTTP/1.1 101

Slide 200

Slide 200 text

WebSocket Client Server GET / HTTP/1.1 HTTP/1.1 101

Slide 201

Slide 201 text

WebSocket Client Server GET / HTTP/1.1 HTTP/1.1 101

Slide 202

Slide 202 text

No content

Slide 203

Slide 203 text

No content

Slide 204

Slide 204 text

No content

Slide 205

Slide 205 text

No content

Slide 206

Slide 206 text

No content

Slide 207

Slide 207 text

Death, Taxes, and HTTP @JesseWilson @JakeWharton