Date post: | 17-May-2015 |
Category: |
Technology |
Upload: | stoyan-zhekov |
View: | 2,400 times |
Download: | 6 times |
Webhooksglue for the Web
120 юни 2009, събота
Who am I ?
• Name: Stoyan Zhekov
• Private: married, 3 kids (boys)
• Work: Software Engineer
• Contact: xmpp: //[email protected]
220 юни 2009, събота
320 юни 2009, събота
Today
• What is this talk about?
• What are webhooks?
• What can they do for me?
• Pros and cons
• Real life usage
420 юни 2009, събота
Maybe you already forget the presentation title, so one more time...
What is this talk about?
520 юни 2009, събота
Webhooksglue for the Web
620 юни 2009, събота
Hooks?720 юни 2009, събота
Glue?820 юни 2009, събота
Web 3.0920 юни 2009, събота
Don’t worry. We will talk about web :)
Web x.0?
• Web 1.0 - static
• Web 2.0 - dynamic? social?
• Web 3.0 - real time?
1020 юни 2009, събота
Google Wave, iPhone push notifications
Web 3.0
• Real Time
• Does it scale?
• PubSub
1120 юни 2009, събота
Real Time1220 юни 2009, събота
Real Time Web
• RSS is not enough (SUP)
• XMPP
• Webhooks
1320 юни 2009, събота
I spoke in Kobe about SUP and XMPP (see my other presentations - http://www.slideshare.net/zhesto/microblogging-via-xmpp
No Polling!1420 юни 2009, събота
Image from the presentation ”Web Hooks and the Programmable World of Tomorrow”
Real Time1520 юни 2009, събота
Does it scale?
1620 юни 2009, събота
Recently working a lot with EC2 - pay per use, scale easy - instant start/stop of instances
Clouds...
1720 юни 2009, събота
Clouds?1820 юни 2009, събота
Computer cloud!1920 юни 2009, събота
Communications2020 юни 2009, събота
Communications
• Messaging (AMQP): RabbitMQ
• XMPP, Ejabberd, Prosody
• Webhooks
2120 юни 2009, събота
Webooks can help you with the infrastructure. Some service is too heavy? - move it to another machine and connect them with webhook. Think about webhooks even when on a single machine (call by URL, not by function name)
PubSub
2220 юни 2009, събота
Publishers2320 юни 2009, събота
Subscribers2420 юни 2009, събота
Publishers and Subscribers
2520 юни 2009, събота
Watercoolr
•PubSub
•Webhooks
•Ruby
http://github.com/zh/watercoolr/http://github.com/jcapote/watercoolr/
2620 юни 2009, събота
PubSubHubBubhttp://code.google.com/p/pubsubhubbub/
2720 юни 2009, събота
What are webhooks?2820 юни 2009, събота
Image from the presentation “Using Web Hooks”I keep repeating webhooks, webhooks,... So what are they?
Captain Hook2920 юни 2009, събота
SVN Hooks3020 юни 2009, събота
Image from the presentation “Using Web Hooks”
Hooks
• Subversion pre-commit, post-commit
• Git, Mercurial - they have hooks too
• Rails: :before_save, :after_delete
3120 юни 2009, събота
Unix Philosophy
• do ONE THING and do it well
• programs WORK TOGETHER
• UNIVERSAL INTERFACE (text)
3220 юни 2009, събота
Insert here more about the webhooks - POST, etc.example cat | grep | mail -> make this with web too (demo)
UNIX pipes3320 юни 2009, събота
Image from the presentation ”Web Hooks and the Programmable World of Tomorrow”
The Web3420 юни 2009, събота
Image from the presentation ”Web Hooks and the Programmable World of Tomorrow”
Web 3D3520 юни 2009, събота
There are services creating the web pages (feeds). Now nodes communicate via RSS - indirect.Image from the presentation ”Web Hooks and the Programmable World of Tomorrow”
WebApp pipes?3620 юни 2009, събота
Can we make a simple applications and connect them like a pipe?Image from the presentation ”Web Hooks and the Programmable World of Tomorrow”
3720 юни 2009, събота
Image from the presentation ”Web Hooks and the Programmable World of Tomorrow”
POST /service data={ 'message':'hey guys!' }
3820 юни 2009, събота
What are WEBhooks?
webhooks are user defined callback URLs, that point to a web script to run on a
certain event
3920 юни 2009, събота
By letting the user specify a URL for various events, the application will POST data to those URLs when the events occur. Key poins: USER DEFINED, URLs (remote services), RUN ON CERTAIN EVENT (push, no cronjobs etc.)
User defined4020 юни 2009, събота
URLs = remote4120 юни 2009, събота
register URL4220 юни 2009, събота
Image from the presentation “Using Web Hooks”
get notification4320 юни 2009, събота
Image from the presentation “Using Web Hooks”
Why?
4420 юни 2009, събота
Service Integration4520 юни 2009, събота
Flexibility4620 юни 2009, събота
Customization4720 юни 2009, събота
Image from the presentation ”Web Hooks and the Programmable World of Tomorrow”
Webhooks movement
• Jeff Lindsay
• http://blogrium.com/?p=70
• http://webhooks.pbworks.com/
• http://blog.webhooks.org/
4820 юни 2009, събота
Webhooks
• Amazon have Merchant Callback API
• PayPal (Instant Payment Notification)
• GitHub and Google Code
4920 юни 2009, събота
Good and bad5020 юни 2009, събота
Good
• Well known protocol - HTTP
• code libraries (software)
• infrastructure (hardware)
• Easy for vendors (services)
• Easy for users (consumers)
5120 юни 2009, събота
5220 юни 2009, събота
require ‘net/http’require ‘json’
class Userdef commit(message)
Net::HTTP.post_form( User.hook_url,{ :data => message.to_json })
endend
5320 юни 2009, събота
For service providers (publishers)
require ‘net/smtp’require ‘json’require ‘sinatra’
post ‘/hook’ dodata = JSON.parse(params[:data])# do something with the dataNet::SMTP.start(‘localhost’) do |smtp|
smtp.send_message data[‘message’], from, to end
end
5420 юни 2009, събота
For service consumers (subscribers)
Bad
• No standard
• Google Code: XML
• GitHub: JSON
• ping.fm - POST parameters
• Security (authentication)
5520 юни 2009, събота
Real Life Usage
5620 юни 2009, събота
Where to create hooks?
• http://heroku.com/ - Ruby
• GAE - Python, Java, JRuby
• http://scriptlets.org/ - Python, JS
• PHP - almost everywhere
5720 юни 2009, събота
Ready Tools
• GitHub - RunCodeRun
• http://ping.fm/ - IM, email, Skype
• http://postbin.org/ - debug
• SwitchHub, TarPipe
• http://superfeedr.com/ - RSS
• http://bot.im/ - IMified XMPP bot
5820 юни 2009, събота
Demoping.fm + postbin
ping.fm + switchub (+postbin)
5920 юни 2009, събота
create new hook on postbin, login to post.fm/custom/ and put there the url. test: web, email, im?
Questions?
6020 юни 2009, събота