HTML and CSS Reference
In-Depth Information
socket.onerror = function (event) {
// Handle the error event as previously.
};
Sending data is equally easy and can be done as follows:
socket.send("Hello server! I'm a WebSocket
polyfill.");
In normal mode, the preceding lines of code simply wrap the WebSocket object and
execute the native methods. In fallback mode, the library changes the protocol from
WS to HTTP, listens for messages by making HTTP GET requests, and sends mes-
sages using HTTP POST requests.
Note
The specific polyfill solution only required a minor change to our code. Other
solutions might need you to make a lot of modifications or only work with specific
server back-ends. You need to pay close attention to the requirements of each
plugin, its usage, and documentation before using it for production.
Browser plugins
BrowserpluginshavebeenanextremelyhelpfulsolutionforrichInternetapplications
inthepre-HTML5era.Tonamebutafew,developersusedtoofferdesktop-richfunc-
tionality in their websites utilizing the capabilities of Flash (primarily), Silverlight, or
Java. A few years ago, basic UX effects, transitions, and animations could not be
made using plain HTML, CSS, or JavaScript.
To fill this gap, browser plugins provided the developers with a framework which
could be installed in the client browser and allowed richer content.
Browser plugins have several drawbacks that make them deprecated day-by-day.
They are resource-intensive, the user needs to wait more until a page is fully loaded,
Search WWH ::




Custom Search