[Feature Angular 1.3] Support for websockets
Would be great if Angular had an service that provides websockets support.
+1
+1
+1 if it is as a separate module
+1
+1
+1
+1
-1 All you need to do is wrap Socket.IO or SockJS in a service. Not sure why this needs to be core functionality. There are so many other improvements that need to be made that far outweigh a redundant WebSocket wrapper service, and the community doesn't have infinite resources.
^ I agree with you, I think most of us don't want it as a core service but as a component/wrapper only it would be waste of socket.IO if someone write it from scratch
I think it should be an separate module, and get the $http out of the core aswell. Then you can just have a nice wrapper around ajax and websockets.
+1
I think wrapping it in your own service + sockets.io isn't "that" hard, and allows the angular team to focus on other stuff.
I think you are probably right ... it just need a proper example of good integration of socket.io not a full featured core component
http://www.html5rocks.com/en/tutorials/frameworks/angular-websockets/ worked for me pretty well.
Was it a waste of time for the angular team to wrap the XMLHttpRequest? Why not just ask the community to wrap $.ajax or any of the other XMLHttpRequest wrappers out there. I understand the counter points to this feature but in all honesty if the feature is as simple as the opponents are saying then whats the harm in adding it in (and not wrapping a current implementation).
XHR has matured a lot since its inception, despite still being a bit weird in a few ways... But WebSockets aren't totally there yet. We still support IE9 (although maybe it will be phased out sooner than IE8) which doesn't implement sockets at all... And then you end up writing alternative transports (such as XHR longpolling) so that all of the supported browsers are covered... This is a lot of work, which isn't needed by everybody, or even most people.
I'm with you in that websockets are super cool, but alternative libraries like socket.io do a much better job of covering all of the alternative transports that you might need to target a broad range of browsers/devices. In the future, I'm sure we'd love to have builtin (and very simple) WebRTC services and WebSockets services and all that jazz, but it's probably not going to be reasonable for a while yet.
That said, there are plenty of third-party modules incorporating this stuff (@joshkurz gave an example above), so given the availability of these, is it really needed in core just yet?
I don't disagree, the websocket technology is still young, and there's a lot of work to get the web ready for websockets. However you are the first one to bring up this valid point :) The previous nay-sayers simply argued against redundancy of socket and the like (which i was trying to point out as a silly argument).
However a simplistic socket implementation (not worrying about fallback to longpulling) would be enough for now. Since I would assume if you are going to use websockets (and not socket or atmosphere or anything else) you should know what you are doing and want to handle the failovers on your own. My current solution is to wrap atmosphereJS and it works quite nicely. but who is to say it wouldnt be nice to have a simple core implementation.
+1
+1
:+1: