Click here to load reader
Upload
pubnub
View
135
Download
0
Embed Size (px)
DESCRIPTION
WebSockets provide new protocol between client and server which runs over a persistent TCP connection. Through this open connection, bi-directional, full-duplex messages can be sent between the single TCP socket connection (simultaneously or back and forth). Because it is an independent TCP-based protocol, it doesn’t ideally require HTTP tunneling (similar to Netflix and other streaming services), allowing for simplified communication when sending messages. WebSockets come after many other technologies that allow servers to send information to the client. Web applications that use Comet/Ajax, push/pull and long polling all do this over HTTP. Other than handshaking the Upgrade Header, WebSockets is independent from HTTP. Read the blog post here: http://www.pubnub.com/blog/what-are-websockets/
Citation preview
What are WebSockets?
WebSockets is a protocol that enables developers to open a persistent connection and send data in realtime between a client and a server. !WebSockets provide new protocol between client and server which runs over a persistent TCP connection. Through this open connection, bi-directional, full-duplex messages can be sent between the single TCP socket connection (simultaneously or back and forth).
What are WebSockets?
WebSockets come after many other technologies that allow servers to send information to the client. !Web applications that use Comet/Ajax, push/pull and long polling all do this over HTTP. Other than handshaking the Upgrade Header, WebSockets is independent from HTTP.
Pre-WebSockets
WebSockets - A Visual Representation
What you’re trying to do is send and receive small amounts of data, and WebSockets can be used as a base for bidirectional communication. !WebSockets App Examples:
• Chat • Streaming stock quotes or sports statistics • Live updating maps and geolocation • Dashboards for information monitoring
!Overall, WebSockets is one of many solutions to push data between two devices. It’s the blueprint for creating realtime apps on web and mobile.
What Kind of Apps Can You Build with WebSockets?
The WebSockets API and Protocol has been standardized by the IETF and W3C, and is an established realtime protocol for web, desktop, and mobile apps. !Some advantages include:
• Cross origin communication (however this poses some security risks)
• Cross platform compatibility (web, desktop, mobile) • Low weight envelope when passing messages
Pros and Cons of WebSockets
However, the designation of WebSockets as the standard for data push and realtime communication is somewhat of a misnomer around the web as it is described today. !Independent of some open-source solutions, WebSockets are just a part of the puzzle when developing realtime applications. !There are a slew of operational issues a developer may run into when using WebSockets as their realtime solution, especially as the app scales and the user base grows.
Pros and Cons of WebSockets (cont.)
• Network topology • Firewalls • Kernal configs
• Load testing • Security • Scaling, load balancing
Establishing a connection with WebSockets is only the beginning. Now, you need to do something with that persistent connection. This is where PubNub comes in. PubNub provides a set of realtime “building blocks”; services that take advantage of an open socket connection. !Check out all the building blocks here, or some of our most popular ones below: !
• Data Streams: core publish/subscribe for realtime data • Presence: realtime user detection • Storage & Playback: stores, retrieves and replays data
!If you want to get started right away, we recommend starting with our JavaScript Data Streams documentation.
The PubNub Data Stream Network and WebSockets