Cannot read property ‘chrome' of undefined – [cordova-plugin-chrome-apps-socket]

Cannot read property ‘chrome' of undefined – [cordova-plugin-chrome-apps-socket]

  

Good day, 

I was trying to use the cordova plugin "cordova-plugin-chrome-apps-socket" to enable my connect to a TCP server (e.g. 192.168.137.1:4000), but it's not working.

Extensibility Configuration:

Code I used for checking:

The extensibility configuration and code is in a module named "SocketPlugin" and used by the main module "TestApp".

My question is what could be the problem? Is it needed to install a Chrome App to make this work

Hi Jordan,

Cordova is not available when you test your application on the Chrome simulator, only when you generate a native app or run it inside OutSystems Now on a device. That is why testing of plugins can only be done on an actual device.

That being said, while researching to answer your post I stumbled upon this blog post about Microsoft's Cordova Simulate, maybe you can use it to test plugins on your computer (but I've never tried it) but you probably need to make them simulation-compatible (as explained in the blog post I link above).

I forgot to mention that I tested it using native app. Even in the native it can't find the 'chrome.socket' object

Solution

I just solved the problem, it turns out that the url should be "https://github.com/MobileChromeApps/cordova-plugin-chrome-apps-socket.git" and "chrome.socket" object can be accessed in "window" object not "window.plugins" object, therefore it should be "window.chrome.socket". $resolve() was not necessary

Solution