Web Sockets
Upcoming SlideShare
Loading in...5
×
 

Web Sockets

on

  • 2,408 views

 

Statistics

Views

Total Views
2,408
Views on SlideShare
2,062
Embed Views
346

Actions

Likes
1
Downloads
31
Comments
0

2 Embeds 346

http://fryerblog.com 343
http://feeds.feedburner.com 3

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Web Sockets Web Sockets Presentation Transcript

  • WebSockets
    Plugging Into The Web
    Paul Fryer
    Software Architect
    Fiserv
  • What is a WebSocket?
    Full-duplex bidirectional communication channel.
    A very low overhead TCP connection.
    Supported in HTML5 browsers.
    Cross Domain Capable.
  • Why WebSockets?
    Way more faster than Log Polling.
    Works with firewalls/proxies.
    Go from kilobytes of data to 2 bytes.
    Go from 150ms to 50ms latency.
  • Polling vs. WebSockets
    Image Source: Kazzing.com
  • Polling vs. WebSockets
    Image Source: WebSocket.org
  • Browser Support
  • Where is it used?
    Rich Internet Applications (RIA)
    Online Games (Farmville)
    Chat Applications
    Streaming Applications
    Financial Data
    Real Time News
    Real Time Alerts
    Analytics (chartbeat)
  • Pusher
    Pusher (pusher.com) is a hosted API for quickly, easily and securely adding scalable real-time functionality via WebSockets to web and mobile apps.
    Example Apps Built on Pusher:
    http://retrospectiveapp.heroku.com
    http://jzlabs.com/stuff/marblepaint
  • Client Handshake
    GET /demo HTTP/1.1
    Host: example.com
    Connection: Upgrade
    Sec-WebSocket-Key2: 12998 5 Y3 1 .P00
    Sec-WebSocket-Protocol: sample
    Upgrade: WebSocket
    Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5
    Origin: http://example.com
    ^n:ds[4U
  • Server Handshake
    HTTP/1.1 101 WebSocketProtocol Handshake Upgrade: WebSocket
    Connection: Upgrade
    Sec-WebSocket-Origin: http://example.com
    Sec-WebSocket-Location: ws://example.com/demo
    Sec-WebSocket-Protocol: sample
    8jKS'y:G*Co,Wxa-
  • The Connection
    Data is sent in the form of UTF-8 text.
    Each frame of data starts with 0x00 byte.
    Each frame of data ends with 0xFF byte.
    UTF-8 text is in-between the start and ending bytes.
  • JavaScript API
    onopen: When a socket has opened
    onmessage: When a message has been received
    onclose: When a socket has been closed
  • JavaScript API
    var socket = new WebSocket("ws://localhost:8000/ServiceEndpoint/");  
    socket.onopen = function(){  alert("Socket has been opened!");  
    socket.onmessage = function(msg){  
    alert(msg); //Awesome!  }  
  • Socket.io
    Socket IO is a library that supports non WebSocket JS clients.
    It will leverage websockets if available, but fall back to other transports for earlier browsers.
    http://socket.io
  • Kaazing Enterprise Gateway
  • Building a WebSocket Server
    .Net web socket server:
    http://superwebsocket.codeplex.com/
    Easy to build your own web socket service on base classes.
    Comes with an example chat application.
  • Everyone Go Here:
    bit.ly/r2a459
  • Ideas for Financial Industry
    More responsive user interfaces.
    Financial Dashboards
    Corporate
    Small Business
    Even Personal
    Real time reporting.
    Connected Devices (real time location).