web sockets are not just for web browsers
TRANSCRIPT
About Me
I am a software developer, based out of Phoenix, Arizona, that specializes in
.NET technology.
Expert on just about all areas of MS.NET programming, but focused on, but
not limited to
Connected Systems Technologies
Windows Communication Foundation (WCF)
BizTalk
Windows Workflow Foundation (WF)
SQL Server
Senior Consultant for Neudesic, LLC
VP of Phoenix Connected Systems User Group
What the Heck
are they?Web Sockets
Overview
We got a problemDilemmas With Traditional Methods Ladies and
Gents, We Have
a SolutionSolving the request response
dilemma
Where are the 1s and 0s:Code Bits and Demonstration
Meat of the
Presentation:Web Sockets beyond web
browsers
Wrap it Up
Already!Conclusion, Questions
and Answers
But Why?:Why Use Web Sockets Beyond
Web Browsers
3
1
2
What are Web Sockets?
Web Sockets are a standard created by the
W3C as developed as a part of the HTML5
initiative
RFC 6455 defines constraints for a protocol
Bi-directional session-ful communication
between client and server
Beats old school polling conventions
Request Response Dilemma
API for using Web Sockets
We Got a Problem Here:
Request / Response Dilemma
Request: I need „XYZ‟ resource
Response: Here is „XYZ‟ resource
Client Server
JavaScript Solutions
How do we circumvent the fact that we can‟t receive events on the client
from the server?
JavaScript polling
Short Polling
Client checks every so often for events and messages that the server has queued
Long Polling
Client makes 60 – 120 second connections to the server and waits for events during that
time
If no events are received, the server closes the session
Rinse and repeat
Web Sockets: The Solution to the
Request / Response Dilemma
Web Sockets are full duplex
Walkthrough of the process:
Client establishes web socket connection to server
4 minutes pass
Server determines that an event needs to be sent to the client
Event sent through established connection
Problem solved!!
Important takeaway: Connection is synchronous (connect > disconnect), but
messages are asynchronous
Web Sockets are not Just for Web
Browsers
As of version 4.5, .NET WCF supports Web Sockets
Web Sockets are easily implemented using the netHttpBinding
Full Duplex services
Existing service can quickly and easily add a netHttpBinding to the
configuration in order to implement this
Shortly, I will show you just how that is done
You‟re probably wondering…
Wait a second Chris… You‟re telling me that I can use other applications other
than web browsers?
The Truth and Nothing but the Truth
Yes my friend. This is the magic of open source protocols.
“How?”, you ask. I‟ll show you how!
Why Chris?
Firewall benefits
Web Sockets supported by most firewalls since the underlying protocol is via HTTP
OSI Layer 5+ firewalls still support web sockets due to UPGRADE requests
Platform agnostic protocol
Protocol defined by W3C and not a single vendor
Supports Java clients
Supports .NET clients
Supports Plethora of Platforms (Python, PHP, Perl)
Services can be built once
No more separate solutions for client type restrictions
One service can support various clients
Show me the code one last time!
Demonstrations
One service
Windows 8 client
WPF Client
Web client walkthrough
Code and Slides
• Git Hug: https://github.com/jixer/wcf-windows-8-web-sockets/
• My Blog: http://bloggedbychris.com/
Northwest Valley .NET User Group
Upcoming Meetings:
Scott Williams: Backbone
Fundamentals
Benton Hoelting: TBD
Rick Garibay: Microsoft‟s
Implementation of the
HTML5 WebSockets API
Phoenix Connected Systems User
Group• First Wednesday of
every month @5:30 P.M.
• Microsoft office off of Tempe town lake
• www.pcsug.org
• Twitter: @pcsug
Past Speakers:• Glenn Block: Unlock your
Inner Node.js in the Cloud with Windows Azure
• Dave Cliffe: Getting Nerdy with Workflow: Present and Future
• Brendon Birdoes: MythBusters: Is ASP.Net Web API the Best Way to Build RESTFul Services?
• Rick G. Garibay: A Lap Around WebSockets in the .NET 4.5 Developer Preview
• See calendar for upcoming meetings
• www.nwvdnug.org
• Twitter:@NWVDNUG
• Passion: We love what we do, and we do what we love. It‟s infectious. We go after each goal with uncontained energy and a clear-minded determination to achieve success.
• Discipline: We pursue excellence in everything we do. We demonstrate this through our commitment to consistency, accountability and quality.
• Innovation: We approach challenges from a unique perspective, which allows us to turn great ideas into game-changing products and solutions.
• Teaming: We trust each other, embrace conflict, honor commitments, hold ourselves accountable, and pay attention to results
• Integrity: We uphold the highest standard of ethics at all times, and conduct business the only way we know how, with honesty and transparency.
• Looking for passionate developers that are interested in furthering there career in a exciting environment
• Come on board to work with some of the most passionate individuals in the industry: Many of our top professionals have earned a variety of industry designations and certifications; several are designated Microsoft MVPs and Microsoft Virtual Technical Specialists
• Our Vision isTo be The Trusted Technology Partner in Business Innovation, guiding our customers along the shortest path to their business success
Upcoming Presentations Today
Rick Garibay
Chairman PCSUG
http://rickgaribay.net/
WebSockets Programming in .NET 4.5 and Windows Azure
Room: IRN-129
Time: 1:00pm - 2:00pm
Dan Weinmann and Nathan Smith
Aspect Oriented Programming - Removing code clutter with cross-cutting concerns
Room: IRN-207
Time: 2:15pm - 3:15pm
Michael Collins
http://www.michaelfcollins3.me/
Building Windows Azure applications with Node.js
Room: IRN-232
Time: 3:30pm - 4:30pm