• HTML5 WebSockets
    17 replies, posted
[quote]The HTML5 initiative introduced the Web Socket interface -- now developed as an independent specification -- which defines a full-duplex communications channel that operates over a single socket and is exposed via a JavaScript interface in compliant browsers. The bi-directional capabilities of Comet and Ajax, unlike Web Sockets, are not native to the browser, and rely on maintaining two connections-one for upstream and one for downstream--in order to stream data to and from the browser. In addition, few existing solutions support streaming over HTTP, instead employing a technique called "long-polling" with higher overhead. Web Sockets account for network hazards such as proxies and firewalls, making streaming possible over any connection, and with the ability to support upstream and downstream communications over a single connection, Web Sockets place less burden on your servers, allowing existing machines to support more than twice the number of concurrent connections.[/quote] [url]http://www.websockets.org[/url] Realtime communication with javascript -- Available in some HTML5-ready browsers It's like XHR, but it only connects once, and can send/receive data in real-time Example: [html] <script> if ("WebSocket" in window) { var ws = new WebSocket("ws://websockets.org:8787"); //this service bounces messages back ws.onopen = function() { // Web Socket is connected. You can send data by send() method. ws.send("message to send"); }; ws.onmessage = function (evt) { var received_msg = evt.data; alert(evt.data); }; ws.onclose = function() { /* websocket is closed.*/alert("WebSocket Closed!"); }; }else{ // the browser doesn't support WebSocket. alert("Websocket is not supported in your browser"); } </script> [/html] I've tried this in chrome, and it's kinda cool. Oddly, websockets.org tells me chrome doesn't support websockets, and thinks it's netscape. Some cool stuff: [url]http://bloga.jp/ws/jq/conn/wsdemo.htm[/url] real-time chat. uses a jquery plugin for websockets ([url]http://bloga.jp/ws/jq/[/url])
o cool
Doesn't look THAT interesting.
[QUOTE=Wipmuck;20097168]Doesn't look THAT interesting.[/QUOTE] It would if you knew what it is. [editline]08:14AM[/editline] And how it's an advantage over previous technologies
[QUOTE=DrTaxi;20097192]It would if you knew what it is. [editline]08:14AM[/editline] And how it's an advantage over previous technologies[/QUOTE] Yeah, i have no idea really.
Waiting for a web skype client now...
[QUOTE=Wipmuck;20097215]Yeah, i have no idea really.[/QUOTE] Well don't comment. As Confucius once said, "He who have no idea should not reply to threads"
That's awesome. I love HTML5. First <video> tags. Now this..
Too bad all the cool ports will be locked down :(
A more usable alternative to APE server project, I feel.
The future with HTML5/CSS3 is looking good
This means I can make an HTTP server that runs within my web browser! :v:
I don't think so since it only connects to servers, not creates them
This is PERFECT for my new project. HTML5 is making my life so much easier..
@tobias, Careful, it won't be supported til 2012 and IE can't run it xD Although there is a guy working on an HTML 5 plugin for <video> tags
Yeah, youtube has taken up html5 now. ([url=http://www.youtube.com/html5]sauce[/url])
[QUOTE=bios_hazard;20510619]@tobias, Careful, it won't be supported til 2012 and IE can't run it xD Although there is a guy working on an HTML 5 plugin for <video> tags[/QUOTE] I wasn't planning on supporting IE, but rated funny 'cause it was.
I can't wait for some of the cool things that'd use this.
Sorry, you need to Log In to post a reply to this thread.