Socket Vs. HTML in Opera
Web developers write HTML applications that connect to networks -- such as the Internet -- using software components called sockets. WebSockets is the name of an emerging technology that allows a single socket to work faster and more efficiently. If you create HTML applications for Opera using regular sockets, you can also experiment with WebSockets once you understand how they work.
-
WebSockets
-
Traditional HTML requests for information use a process called Hypertext Transfer Protocol. When a browser asks a Web server for content, the server sends it back, and the browser constructs a Web page from the information it receives. It takes time for this data exchange to occur. WebSockets do not use HTTP. Instead, they open continuous communication channels that allow remote computers to transmit information in two directions at once. This bidirectional communication can result in increased responsiveness and lower network latency. Latency refers to the time it takes for data to flow from one computer to another over a network.
WebSocket Benefits
-
If your website simply needs to request a page from a Web server and display it for a user, it may not need to use WebSockets. Other applications that poll Web servers frequently may see significant performance gains using this technology. Users who enjoy fast-paced multiplayer games, for instance, can battle from remote computers and experience good game performance without using special plug-ins. Web applications that allow users to share message boards or draw in real time might also benefit from the bi-directional communication benefits that WebSockets provide.
-
Opera WebSocket Support
-
Before testing this new technology, you must enable support support for WebSockets in your Opera browser Do this by typing opera:config in the browser's Address bar and pressing "Enter." You can then place a check mark next to the "Enable WebSockets" item in the Preferences window that appears. It doesn't take much code to begin a WebSockets session. Create one using the code shown in the following example:
var myConnection = new WebSocket('Server');
Replace 'Server' with the name of your Web server, run the code and your browser attempts to establish a connection to the server. If the connection succeeds, your application can exchange text messages with the server.
Considerations
-
Your Web application could fail to work if it attempts to communicate with a Web server that uses a different WebSockets protocol. Although using WebSockets to create Opera Web applications has benefits, the technology is still new, communication errors can occur and the WebSockets protocol is not stable. For now, experiment with WebSockets technology. Continue to use traditional programming methods for production work until Websockets technology stabilizes.
-
References
Resources
- Photo Credit Hemera Technologies/AbleStock.com/Getty Images