home

HTML5 Web Workers

Web Worker completely javascript depended, javascrpt running in the background with affecting on page performance.

When executing script the page becomes unresponsive until the script is finished. A web worker runs in the background relatively heavy-weight and are not intended to be used in large numbers independently of other scripts, without affecting the performance of the page. You can continue to do whatever you want: clicking, selecting things, etc., while the web worker runs in the background.

<div>Out Put: <output id="result"></output></div>
<button onclick="start_Worker()">Start-Worker</button>
<button onclick="stop_Worker()">Stop-Worker</button> <script> var x; function start_Worker() { if(typeof(Worker) !== "undefined") { if(typeof(x) == "undefined") { x = new Worker("workers.js"); }
x.onmessage = function(event) { document.getElementById("result").innerHTML = event.data; };
}else{
document.getElementById("result").innerHTML = "Not supporting";
} } function stop_Worker() { x.terminate(); x = undefined; } </script>

HTML5 Web Socket

Web socket is communicator technology for web application which operates a single application and exposed via JavaScript interface in HTML 5 compliant browsers.

Web sockets has events and method Read More About web socket