web hooks

54
there once was a command line nav filesystem, launch apps, write scripts

Upload: jeff-lindsay

Post on 17-May-2015

16.354 views

Category:

Technology


2 download

DESCRIPTION

A talk I gave at several places trying to evangelize the web hook pattern. More information at http://webhooks.pbwiki.com

TRANSCRIPT

Page 1: Web Hooks

there once was a command linenav filesystem, launch apps, write scripts

Page 2: Web Hooks

Program

Input Output

lots of power in a bit of infrastructure involving input and output

Page 3: Web Hooks

Program

STDIN STDOUT

STDERR

stdin, stdout were available to reroute wherever the user wantedmost common use was chaining commands together: piping

Page 4: Web Hooks

Program

STDIN STDOUT

STDERR

Infrastructure

this was an amazing amount of infrastructure based on a very simple idea

Page 5: Web Hooks

1977and we’ve had it since 1977

Page 6: Web Hooks

1997fast foward 20 years just after commercialization of internet to a perl conferencejon udell talks about websites as data sources that can be reused and remixedtoday that idea isn’t very novel

Page 7: Web Hooks

1997

a new programming paradigm that takes the whole Internet

as its platform

he also talked about a new programming paradigmi don’t think we’re there yetbut this inspired ...

Page 8: Web Hooks

“What is the equivalent of the pipe in the age of the web?”

tim oreilly to ask in 2000...

Page 9: Web Hooks

there seems to be resounding consensus the answer is feedsthey sound good in theory

Page 10: Web Hooks

it makes you think of feeds like in the telecom world

Page 11: Web Hooks

data coming directly to you

Page 12: Web Hooks

but we know that’s not how it works

Page 13: Web Hooks

?

instead we have to go request the data

Page 14: Web Hooks

then it gives it to us. and we do this over and over.

Page 15: Web Hooks

?

client side mashups might be able to get by with this

Page 16: Web Hooks

?

but when you start talking about persistent web applications, it becomes a bit more work

Page 17: Web Hooks

?

• Crontab / Daemon• Parsing• Caching

Page 18: Web Hooks

?

• Crontab / Daemon• Parsing• Caching

this is just too much work sometimes

the other problem i have is with the command line metaphor for web apps

Page 19: Web Hooks

Start Stop

Command-line Application

because a command line application is linear. it starts, runs, and stops

Page 20: Web Hooks

AlwaysRunning

WebApplication

web apps are always running.a better metaphor for this is a running process or daemon

Page 21: Web Hooks

here we have some daemons.this is ps doomso using this metaphor, how do daemons communicate?

Page 22: Web Hooks

IPC?Inter process communication

ipc?

Page 23: Web Hooks

lolh4x

stfun00b

...yeah. my experience with ipc was pretty bad. ipc usually involves some sort of shared memory mechanism, like a queue

Page 24: Web Hooks

it turns out amazon provides a queue web servicebut with a third party queue you only defer the pollingit doesn’t solve the problem, its just fancier rss

Page 25: Web Hooks

so this is not the solution, and probably why not too many people use or know of it

Page 26: Web Hooks

Real-timeEfficient

Easy

Page 27: Web Hooks

Web Hooks

web hooks are user defined callback URLs that point to a web script to run on a certain event.you can call them other things...

Page 28: Web Hooks

Web Hooks• User Callbacks• Triggers• Event Handlers• “Plugouts”

web hooks are user defined callback URLs that point to a web script to run on a certain event.you can call them other things...

Page 29: Web Hooks

to implement web hooks, you generally provide a ui--

Page 30: Web Hooks

for the user to specify a url for events

Page 32: Web Hooks

Infrastructure

http://example.com/post-commit.php

what this does is creates powerful infrastructure that might not be obvious at the surface

Page 33: Web Hooks

Easy for Vendors

the idea is that it’s easy for vendors to integrate

Page 34: Web Hooks

the main mechanism is a standard http post, which is trivial in most environments

Page 35: Web Hooks

Easy (enough) for Users

it’s also very open and easy for the users, which will generally be advanced users, but can easily be taken advantage of by novice users

Page 36: Web Hooks

as a user, to take advantage of hooks, you’d write a script to handle an event, like the committhis is a very simple script

Page 37: Web Hooks

“Internet”

so what the user would do

Page 38: Web Hooks

“Internet”

is put that script up on the internet

Page 39: Web Hooks

“Internet”

then they’d go to the hook settings page

Page 40: Web Hooks

and hook the commit event up to their script

Page 41: Web Hooks

then as the user interacts with devjavu

Page 42: Web Hooks

Commit!

and they make a commit, it fires a post to their script

Page 43: Web Hooks

Commit!

the script runs, and send an email to the mailing list

Page 44: Web Hooks

Commit!

this makes the user a happy cookie. and this is a trivial example, using only on web service. imagine using the api of another in the hook script and chaining these things together

Page 45: Web Hooks

Commit!

but even in this simple example, you see the power it gives to the user and to the data that we’re trying to “open up” to our users

Page 46: Web Hooks

Program

STDIN STDOUT

back to piping on the command line, remember that it was simple infrastructure that gave you tremendous power, and one of the key components was making it easy to chain commands

Page 47: Web Hooks

Program

STDIN

we wouldn’t be able to do it without the output part of it

Page 48: Web Hooks

Web App

API

unfortunately that’s how the web is today. the only output you can get is by using the input (api, feed)

Page 49: Web Hooks

Web App

API Hooks

web hooks gives us this output, and when *combined* with the input of api’sit will give us and our user tremendous power that i think will really push the webinto being a new programmable paradigm

Page 50: Web Hooks

Program the Web

the possibilities become very rich and i’ve thought about it a lotthere’s probably a lot moreimagine realtime data syncronizationor a chain of events that makes these apps work together in a way you’ve never imagined

Page 51: Web Hooks

Fin

Page 52: Web Hooks

Questions?

blogrium.com

Page 53: Web Hooks

SuperHappyDevHouse

Page 54: Web Hooks

Web App

API Hooks

web hooks gives us this output, and when *combined* with the input of api’sit will give us and our user tremendous power that i think will really push the webinto being a new programmable paradigm