HTML and CSS Reference
In-Depth Information
The server websocket.org currently only accepts small messages, so this
example will only work with image files less than 65kb in size, though this limit may change.
You can experiment with larger media on your own servers.
Note
The “wow” factor of this demo may be diminished by the fact that the media is
originating from the same browser where it is ultimately displayed. You could accomplish
the same visual result with AJAX or even without the network at all. Things get really
interesting when a client or server sends some media data out that is displayed by a
different browser—even thousands of other browsers! The same mechanics of reading
and displaying binary image data work in a broadcast scenario just the same as in this
simplified echo demo.
Summary
In this chapter, you learned about the various aspects of the WebSocket API, which
enables you to initiate a WebSocket connection from a client application running in a
browser and send messages from a server over a WebSocket connection to your client.
You learned the basic concepts behind the WebSocket API, including events, messages,
and attributes, as well as saw a few examples of the API in action. You also learned
how to create your own WebSocket application with a publicly available WebSocket
Echo server, which you can use for further testing of your own applications. For an
authoritative definition of the interface, see the full WebSocket API specification at
http://www.w3.org/TR/websockets/ .
In Chapter 3, you will learn about the WebSocket Protocol and step through
constructing your own basic WebSocket server.
 
 
Search WWH ::




Custom Search