Ionic V2 Chrome sockets not loaded?

i have an ionic 2 app, both android and IOS.

migrated from Ionic 1. both platforms worked without problems.

it uses the chrome.sockets plugins…

I had to add (’<‘any’>’ text`window). in front of the calls. chrome sockets…

on android this works fine. I spent a while discovering that in addition to the cordova plugin add,
I also need to npm i the plugins…

on ios the plugins appear not to be loading…


[10:53:59] console.log: chrome=undefined

and the exception handler for
(’<‘any’>'window).chrome.sockets.tcpServer.listen(createInfo.socketId,ip, 0,1, …

[10:53:59] console.log: sockets failure=TypeError: undefined is not an object (evaluating ‘’)

i have uninstalled the plugins, done the npmi for the plugins, done the cordova add for the plugins
checked the config files and package.json… added the missing plugin file definitions…

still no change…

the source is a tar/untar of the src folder from the android system on ubuntu to my mac
same project name, etc… i rebuilt the project from scratch on ios then copied the src folder)

any pointers welcomed

the ‘<‘any’>’ is without the quotes, else it wouldn’t show up here

well, I answered my own question… on ios the plugins are not really loaded til platform.ready()…

after adding this to my page (have to wait for cordova to be ready)

import { Platform } from ‘ionic-angular’;

add platform to my page constructor
constructor(public navCtrl: NavController, public navParams: NavParams,private data: DataProvider,public viewCtrl: ViewController, platform:Platform){

then add this to my function or constructor
(readySource) => {
console.log(“Platform ready!”);
if(readySource == ‘cordova’)
<---- chrome sockets is now loaded and ready —>

works on Android too.

found the info here