Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

Web Sockets

Another kind of communication between a server and a browser is a web socket, which is a bidirectional protocol that travels over a TCP socket. It's not HTTP, but an entirely different socket-based protocol. This means you can't use Apache to send out data without a custom module or proxy to another server.

If you are looking for a way to implement a chat program or other real-time application where you're constantly sending and receiving data from a server or other users, you might use web sockets over traditional http/web programming.

For a list of server implementations see the following.

http://en.wikipedia.org/wiki/Comparison_of_WebSocket_implementations

Now even though I'm not going to implement a server solution here I'd like to invoke a current web socket at WebSocket.org. Here just like the other message implementations we write an event handler called onmessage, to take care of the response.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint