WooHoo, I have finally released it; http://github.com/NathanaelA/NativeScript-Websockets. I only have been discussing it for almost a month. I had it working on Android almost a month ago; and then on iOS shortly afterwords. However, doing documentation; making a easy to use consistent interface, building install routines. And then fixing BUGS. Ouch, tracing bugs in NativeScript, iOS and Android and in the two third party libraries I used, was not exactly fun. But I am very happy with the state of the library now. The library not only support Text messages; but fully supports binary messages also!
You should be able to do a tns plugin add nativescript-websockets to install it on both iOS and Android. iOS as usual has a few items you have to do afterwords to the xcode project. And hopefully by the time you read this post; Telerik will have released v1.2.2 of the iOS runtimes. They have already tagged the v1.2.2 a couple days ago; so I assume they are running tests. But until you have the v1.2.2 iOS runtimes you will need to use the workaround I put in as the first issue on the nativescript-websockets repo.
The NativeScript-WebSockets supports TWO interfaces; I'm particularly proud of this feature -- you can do var ws = new WebSocket(url, protocol); just like you would do on a browser and all the functions and events are present so this as far as I can tell fully emulates the web socket on your browser. The second interface is much more advanced and allows re-connecting on a dead socket and timeout support. See the documentation for more details on both interfaces.
I would like to thank Nathan Rajlich for his Java_WebSocket library which is what I used as the base of the Android version: https://github.com/TooTallNate/Java-WebSocket
And thank Robert Payne (of Zwopple) for his PocketSocket library which is what I used as the base on the iOS version: https://github.com/zwopple/PocketSocket