From: Sidney San Martín <s...@sidneysm.com>
Date: Wed, 20 Jan 2010 00:37:06 -0500
Local: Wed, Jan 20 2010 12:37 am
Subject: Re: [jquery-dev] Re: WebSockets is very faster than xhr. I hope to support of jQuery for WebSockets.
If I'm reading you correctly, jQuery support for Web Sockets would be: 1. Feature detection through jQuery.support (1) would make sense only if there were other support in jQuery, (2) is handled by the UA, (3) is protocol-dependent and I'm not sure is even necessary, (4) depends on what you're trying to do with data coming out of the socket (and data sanitation should be handled by the server in most cases). (5) is a different question entirely. I've definitely seen posts pop up on discussion boards and mailing lists asking "how can I rewrite such-and-such JavaScript in jQuery?" While if (typeof WebSocket === 'object') { doesn't fit in with existing jQuery code as well as if ($.support.sockets) { should anyone care? I don't know. The jQuery object always represents a collection of DOM elements because jQuery has always been about talking to the DOM. On the other hand, with JSON-encoded responses $.ajax succeeds in turning XMLHTTPRequest into a tube that you can shove objects and arrays into and get same back. That's solidly outside DOM territory but is a well-worn jQuery feature. Automagic response parsing into native types could work for Web Sockets as well. There are more wild and interesting things that *could* be done by abstracting a bit — like the framework maintaining a single socket to your app and triggering custom event handlers based on metadata in messages — but it's still way to early to suggest putting any of that in jQuery proper. If you want to live on the bleeding edge, write some code. Sanding down the API can come once we know what the heck we want it to look like. On Jan 19, 2010, at 10:00 PM, tato wrote: > Hi Friesen
> Your code is yes. Please try following. > <input type="text" id="test" value="hello!"> > <script> > You send 'hi!', You'll receive 'hi!' > eg. > GET /echo HTTP/1.1・・Upgrade: WebSocket・・Connection: Upgrade・・Host: > This "ws://bloga.jp:80/echo" is a echo server of mod_pywebsocket's > Well, There are three ways > 1.Min support > I think, case 3: >> WS isn't HTTP > Yes, it is. Upgrade: WebSocket from HTTP GET. > eg. > tcp 192.168.1.4:1715 > 202.215.119.36:80 >> You do realize that WS cannot be used in most shared hosting setups? > When I started my JavaScript (1996), AddType application/x- > I do not know the future, however, if it was useful, I think that > Thanx > On Jan 20, 3:09 am, Daniel Friesen <nadir.seen.f...@gmail.com> wrote: >>> First the excuses. This is a discussion about the future. >>> Browser's between incompatibility in ajax was need JS Library / >>> But even if there is compatibility, jQuery support of xhr is useful. >>> Future browser with WebSockets implemented, I want compatibility >> Less code? >> }; >> How much shorter can jQuery possibly make that? >>>> WS is a bi-directional non-HTTP socket which needs a dedicated server. >>> It's non-HTTP, but it's on-HTTP too. >>> I tested on mod_pywebsocket, that is a Web Socket extension for Apache >>> http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-44#sectio... >> WS' handshake is HTTP-like. The only "HTTP" in WS is a handshake that >> You do realize that WS cannot be used in most shared hosting setups? >>>> WS is simply "faster" because it doesn't need all the extra cruft in a >>> HTTP call >>> I think so too. XHR requires a lot of headers, and many connections. >>> WS is so friendly for network and servers. Moreover, "faster" on HTTP. >>> With Best regards, for into the good future >>> On 1月19日, 午前2:27, Daniel Friesen <nadir.seen.f...@gmail.com> wrote: >>>> I don't like the idea. At this point there is no reason to believe that >>>> In any case, comparing WS to XHR in terms of speed is completely >>>> ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name] >>>> ... >> ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| |||||||||||||||||