Web Hooks On Pbwiki

Post on 07-Dec-2014

8.375 views 2 download

description

SHDH23 presentation about web hooks - lightweight event-triggered web plumbing

Transcript of Web Hooks On Pbwiki

Web HooksNear-Real-Time, Simple awesomeness

coming soon!

nathan@pbwiki.com

Recall From SHDH 17Jeff Lindsay’s“Web hooks”lightning talk

• RSS relies on polling. • Polling is lame.• Syndication and (re)publishing, not triggering

Recall From SHDH 17Jeff Lindsay’s“Web hooks”lightning talk

• Often n consumers.• Not 1000n.• Polling is still lame. • Are we there yet?• Are we there yet?• Are we there yet?

NO(for some things)

Recall From SHDH 17Jeff Lindsay’s“Web hooks”lightning talk

• Event-driven.• Lightweight.• POST to a URL.

Recall From SHDH 17Jeff Lindsay’s“Web hooks”lightning talk

• Event-driven.• Lightweight.• POST to a URL.

OLD LOGO

Web hooks in practice

//something ...hook_trigger(‘viewpage’);//more stuff..

async

asyncwhile(1) {

while($queued = $q->get(‘async-queue’)) { post_to_url($queued[‘url’],$queued[‘postargs’]);}

}

Web hooks in practice

Example hooked events• login/logout• edit a page• revert a page• delete a page• comment on a page• tag/untag pages• join/unjoin wiki• return_after_absence• view_for_first_time

Web hooks in practice

Web hooks in practice

Web hooks in practice

Web hooks in practice

Web hooks in practice

I want this to exist:

Trigger Filter Branch/Merge Transform Route

incoming web hook

$page =~/deploy/i

$to = [‘devel@’,ops@’]

$msg = fmt_to_aim($attrs) out_aim($to,$msg)

$uid == da39a3ee5e6b4b

$to = @all_sms;unset($to[$uid]);

$msg = fmt_to_sms($attrs)

out_sms($to,$msg)

$viewcount == 100 $to = $emails[$uid] $msg = “Wow you’re a power user”

out_email($to,$msg)

$op == ‘edit’ $to = [‘http://my.com/’,‘http://twittr.com/me’] $msg = $attrs out_hook($to,$msg);

= awesome but only polling (RSS)