{"id":95,"date":"2015-08-16T01:05:32","date_gmt":"2015-08-16T01:05:32","guid":{"rendered":"http:\/\/fluentreports.com\/blog\/?p=95"},"modified":"2015-08-16T01:05:32","modified_gmt":"2015-08-16T01:05:32","slug":"announcing-nativescript-websockets","status":"publish","type":"post","link":"http:\/\/fluentreports.com\/blog\/?p=95","title":{"rendered":"Announcing NativeScript-WebSockets!"},"content":{"rendered":"<p>WooHoo, I have finally released it; <a href=\"http:\/\/github.com\/NathanaelA\/NativeScript-Websockets\" target=\"_blank\">http:\/\/github.com\/NathanaelA\/NativeScript-Websockets<\/a>. I only have been discussing it for almost a month.\u00a0\u00a0 I had it working on Android almost a month ago; and then on iOS shortly afterwords. \u00a0\u00a0 However, doing documentation; making a easy to use consistent interface, building install routines. \u00a0 And then fixing BUGS.\u00a0 Ouch, tracing bugs in NativeScript, iOS and Android and in the two third party libraries I used, was not exactly fun.\u00a0\u00a0\u00a0 But I am very happy with the state of the library now.\u00a0 The library not only support Text messages; but fully supports binary messages also!<\/p>\n<p>You should be able to do a <strong>tns plugin add nativescript-websockets<\/strong> to install it on both iOS and Android.\u00a0\u00a0 iOS as usual has a few items you have to do afterwords to the xcode project.\u00a0 And hopefully by the time you read this post; Telerik will have released v1.2.2 of the iOS runtimes.\u00a0 They have already tagged the v1.2.2 a couple days ago; so I assume they are running tests.\u00a0\u00a0 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 <a href=\"https:\/\/github.com\/Nathanaela\/nativescript-websockets\/issues\/1\" target=\"_blank\">nativescript-websockets repo<\/a>.<\/p>\n<p>The NativeScript-WebSockets supports TWO interfaces; I'm particularly proud of this feature -- you can do <strong>var ws = new WebSocket(url, protocol);<\/strong> 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.\u00a0\u00a0\u00a0\u00a0 The second interface is much more advanced and allows re-connecting on a dead socket and timeout support.\u00a0\u00a0\u00a0 See the documentation for more details on both interfaces.<\/p>\n<p>I would like to thank <a href=\"https:\/\/n8.io\/\" target=\"_blank\">Nathan Rajlich<\/a> for his Java_WebSocket library which is what I used as the base of the Android version: <a href=\"https:\/\/github.com\/TooTallNate\/Java-WebSocket\" target=\"_blank\">https:\/\/github.com\/TooTallNate\/Java-WebSocket<\/a><\/p>\n<p>And thank Robert Payne (of <a href=\"http:\/\/zwopple.com\" target=\"_blank\">Zwopple<\/a>) for his PocketSocket library which is what I used as the base on the iOS version: <a href=\"https:\/\/github.com\/zwopple\/PocketSocket\" target=\"_blank\">https:\/\/github.com\/zwopple\/PocketSocket<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WooHoo, I have finally released it; http:\/\/github.com\/NathanaelA\/NativeScript-Websockets. I only have been discussing it for almost a month.\u00a0\u00a0 I had it working on Android almost a month ago; and then on iOS shortly afterwords. \u00a0\u00a0 However, doing documentation; making a easy to use consistent interface, building install routines. \u00a0 And then fixing BUGS.\u00a0 Ouch, tracing bugs&hellip; <a class=\"more-link\" href=\"http:\/\/fluentreports.com\/blog\/?p=95\">Continue reading <span class=\"screen-reader-text\">Announcing NativeScript-WebSockets!<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[3,15],"tags":[],"class_list":["post-95","post","type-post","status-publish","format-standard","hentry","category-javascript","category-nativescript","entry"],"_links":{"self":[{"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/95","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=95"}],"version-history":[{"count":3,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/95\/revisions"}],"predecessor-version":[{"id":98,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/95\/revisions\/98"}],"wp:attachment":[{"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=95"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=95"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/fluentreports.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}