Upload
florin-cardasim
View
2.254
Download
0
Tags:
Embed Size (px)
Citation preview
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
IT Camp 2011
• Thanks for coming!• ITCamp is made possible by our
sponsors:
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
Duplex Communications with WCF and Azure
Florin Cardașim, software developerRomSoft Iași, www.rms.ro
[email protected] | twitter.com/cardasim
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
Session agenda
• Enterprise duplex. Non-browser clients–WCF duplex bindings, router service–Windows Azure Service Bus
• Web duplex. Browser clients– Simple polling, comet/long polling–WebSockets
• Q&A
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
ENTERPRISE DUPLEX
Non-browser clients- WCF duplex bindings, router service- Windows Azure Service Bus
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
Full duplex using WCF NetTcpBinding
Event consumer
Event publisher
Publisher requires public IPCustom ports open in firewall
Full duplex TCP
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
“Full duplex” using WCF WSDualHttpBinding
Event consumer
Event publisher
Network address translation makes connection back
impossible
Duplex HTTPNAT
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
“Full duplex” using WCF WSHttpBinding
Event consumer
Event publisher
Publisher and consumers require public IPThat’s fine, BUT we want the servers INSIDE the enterprise
Dual HTTP
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
WCF Router Service
Event consumer
Event publisher
Firewall and NAT friendlyRouters have protocol bridging, failover etcNot bad, but quite crowded. Can you do better?
Dual HTTP TCPTCP
Router Service Router Service
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
Windows Azure Service Bus
Eventconsumer
Event publisher
Relay Service
sb://itcampnamespace.servicebus.windows.net/publisher
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
DEMO
Connecting the enterprises via:-NetTcpBinding, WsDualHttpBinding-RouterService, NetTcpBinding, WsDualHttpBinding-Service Bus, NetEventRelayBinding
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
Enterprise duplex: conclusions
• Direct TCP is best IF available• public endpoint , open ports in firewall
• Duplex HTTP is an alternative• public IP both publisher and consumer, port 80
• Router Service bridges the enterprises• flexible, but quite complicated deployment
• Azure Service Bus• very flexible & powerful; requires careful
planning because each connection costs money
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
WEB DUPLEX
Browser clients- Simple polling, comet/long polling- WebSockets
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
Http polling
• Wasted resources, many requests return no data
• Frequent polling means higher load on the server
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
Comet/long polling
• Bandwidth: small payload, large http headers overhead
• Scalability: pressure on memory, bandwidth, threads/processes
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
DEMO
An open source, WCF based, long polling server implementation:http://laharsub.codeplex.com/
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
Html5 WebSockets
• Full duplex, bidirectional• Single TCP socket• Standard ports: http/80,
https/443• Bandwidth savings• More scalable than Comet• Nice programming model• In&outside of browser
Open WebSocket Connection
Server
Client
Drafts:-IETF WebSockets Protocol-W3C WebSockets API
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
Html5/websockets: server
• Socket.IO (Java, node.js)
• Jetty (Java)• Ruby/EventMachine• Python/Twisted• WCF websocket
prototype • … others
• Socket.IO Fallbacks– Adobe Flash Socket– AJAX Long Polling– AJAX Multipart
Streaming– Forever iFrame– JSONP Polling
• http://socket.io/
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
Html5/websockets: server
• Test browser support: http://websocket.org/echo.html
• Microsoft is still experimenting
• http://html5labs.com
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
DEMO
Some WebSockets in action:http://kaazing.mehttp://retrospectiveapp.heroku.com
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
DEMO
Using the WCF WebSockets prototype from http://html5labs.com
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
References
• channel9.msdn.com/Learn/Courses/Azure/ServiceBus
• en.wikipedia.org/wiki/Comet_%28programming%29
• html5rocks.com/tutorials/websockets/basics• websocket.org• pusher.com• kaazing.com• live.visitmix.com/MIX11?q=web+sockets• paulbatum.com
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
Q&A
@itcampro / #itcamproPremium conference on Microsoft’s Dev and ITPro technologies
Don’t forget!
Get your free Azure pass!
• 30+15 days, no CC req’d– http://bit.ly/ITCAMP11– Promo code: ITCAMP11
We want your feedback!
• Win a WP7 smartphone– Fill in your feedback
forms– Raffle: end of the day