Results 1 to 3 of 3

Thread: HTML5 WebSocket

  1. #1
    Join Date
    Jul 2010
    Posts
    93

    HTML5 WebSocket

    The advent of AJAX has been revolutionary, all the biggest and most popular Web applications have been this wave of change and have the ride to offer a better user experience. This technology, however, as we all know, has many limitations and can be greatly improved. Precisely for this reason, standardization bodies have tried to introduce the Web in the news related to the upcoming HTML 5, a component that could replace and improve AJAX: the WebSocket. They offer a two-way communication channel (either from client to server or vice versa) and full-duplex (read and write at the same time) based on TCP. The standardization process is still ongoing but it seems to have reached an acceptable level of stability and formality to be able to discuss and analyze its operation.

    Compatibility

    Here is the list of major browsers and their rendering engine with the implementation of the standard specification WebSocket:

    • Internet Explorer / Trident: does not support WebSocket
    • Firefox / Gecko: WebSocket the support from version 4.0
    • Safari / WebKit: WebSocket support from version 5.0
    • Chrome / WebKit: WebSocket support from version 4.0
    • Opera / Presto: does not support WebSocket

  2. #2
    Join Date
    Jul 2010
    Posts
    93

    Re: HTML5 WebSocket

    The API exposed

    One of the goals of the W3C was the simplicity and ease of use of WebSocket. The API exposed are very simple. The entire management of communication flow is delegated to an object WebSocket that has methods for sending and event-oriented listeners to receive messages. As we will see shortly, the API is very similar to those used in the previous article concerning WebWorkers. To create a WebSocket the only parameter required is the URL where this must be to:
    var = new webSocket WebSocket ("ws://www.websocket.org");
    Once you create the object we have two methods for sending information and for closing the communication channel:
    webSocket.send ("Hello world");
    webSocket.close ()
    Instead of interacting with the messages received from the server and the state change can use the same WebSocket listeners:
    Code:
    webSocket.onopen = function (event) {
      console.log ("Connection opened");
     }
     
     webSocket.onmessage = function (event) {
     console.log ("Server says" + event.data);
     }
    
     webSocket.onerror = function (event) { 
     console.log ("Error!!");
     }
     
     webSocket.onclose = function (event) {
     console.log ("Connection closed");
     }

  3. #3
    Join Date
    Jul 2010
    Posts
    93

    Re: HTML5 WebSocket

    The Web Socket protocol

    The communication between client and server is via a particular protocol, similar but not compatible with HTTP. To see the work-based application WebSocket you need to have a web server that supports this protocol today and are not yet functional and stable solution especially given the still low level of dissemination of specific browser.

    Basic Information

    WebSockets is a modus operandi for two-way communication over one (TCP) socket, a type of PUSH technology. At the instant, it’s still being consistent by the W3C; however, the newest versions of Chrome and Safari have support for WebSockets. Websockets can reinstate long-polling. This is a fascinating perception; the client sends a request to the server – now, rather than the server responding with data it may not have, it fundamentally keeps the connection open until the fresh, up-to-date data is ready to be sent – the client next receives this, and sends an additional request. This has its benefits: diminished latency being one of them, as a connection which has already been opened does not necessitate a new connection to be established. However, long-polling isn’t really a piece of fancy technology: it’s also probable for a request to time-out, and thus a new connection will be needed anyway. Many Ajax applications make use of the above – this can often be attributed to underprivileged resource utilization.

Similar Threads

  1. Is it worth to go for HTML5 right now
    By klinsmann in forum Software Development
    Replies: 8
    Last Post: 27-11-2013, 02:16 PM
  2. HTML5 for Beginners
    By Andrew in forum Guides & Tutorials
    Replies: 2
    Last Post: 10-10-2012, 03:02 PM
  3. HTML4 vs. HTML5
    By Deandre in forum Polls & Voting
    Replies: 2
    Last Post: 30-03-2011, 12:11 PM
  4. New thing about HTML5
    By Atalaya in forum Windows Software
    Replies: 5
    Last Post: 03-12-2010, 12:04 AM
  5. Want to know about html5
    By Charites in forum Windows Software
    Replies: 3
    Last Post: 22-11-2010, 02:29 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,980,000.47455 seconds with 16 queries