Skip to content

Commit c0a7e62

Browse files
committed
How to choose the right streaming protocol
1 parent 6b7669c commit c0a7e62

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ Building a simple chat app that uses websockets is easy, but rich, non-trivial,
8585
* Base the application on [Express and SockJS](https://github.com/socketstream/ss-examples/tree/master/express-4-and-js)
8686
* Make a minimal application like [SocketStream 0.3](https://github.com/socketstream/ss-examples/tree/master/legacy-app)
8787
* Serve [HTTP resources and pages](http://socketstream.github.io/socketstream/docs/#/tutorials/serving_http_resources)
88+
* Choosing the right [Streaming Protocol](http://socketstream.github.io/socketstream/docs/#/tutorials/choosing_protocol)
8889

8990
### Applications using SocketStream
9091

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@ngdoc overview
2+
@name Choosing a Protocol
3+
4+
@description
5+
# Choosing a Protocol
6+
7+
The state of web protocols is such that WebSockets are supported on perhaps 90% of the devices that reach your
8+
website. The first question you have to ask yourself is what to do about the last 10%. You can ignore them and
9+
configure SocketStream to only use WebSockets for streaming connections. This is an option that will be added
10+
in version `0.7` and be stable in `0.8`.
11+
12+
Otherwise you can support 100% of devices with fallback protocols such as "engine.io" or "SockJS". They are both
13+
mature but with different approaches. SockJS tries to open a WebSocket and fall backs to various polling techniques
14+
if it cannot. Engine.io starts with polling and tries to upgrade ultimately to a WebSocket connection. So for
15+
90% of devices SockJS will connect faster.
16+
17+
However engine.io supports compression and binary data, so you may push more data to the client. This may not
18+
be relevant for your application, so both are good options.
19+
20+
For streaming connections it is also important to consider Internet proxies and gateways. Many firewalls only let
21+
through HTTP and stops all other protocols. To support this you cannot use straight WebSockets as the fallback
22+
mechanisms must always be used.
23+
24+
Over the next year HTTP version 2 will become supported in most web browsers and web servers. It allows some
25+
advanced data caching techniques that can be used to achieve Real-Time data streaming to clients over HTTP.
26+
27+
Hopefully we will be able to extend SocketStream with the ability to stream over HTTP/2.
28+
29+
Another interesting candidate is WebRTC which allows browsers to talk to each other. This might also be fitted
30+
into the Real-Time puzzle.

0 commit comments

Comments
 (0)