moscajs / mosca

MQTT broker as a module
mosca.io
3.2k stars 508 forks source link

MQTTjs Websocket Cordova #570

Closed japita-se closed 7 years ago

japita-se commented 7 years ago

Is it possible to user MQTTjs (browserMQTT) in a packed cordova webapp? I tried to port the web page I made by using cordova, but it seems that the websockets not work. Is it a problem of the cordova webkit?

thegafo commented 7 years ago

@japita-se It is definitely possible to use MQTT over WebSockets with Cordova. If I had to guess, your issue is probably related to Cordova's Content Security Policy.

Make sure you whitelist the broker url with the correct port number. This plugin could help. Let me know if that fixes your problem.

keanuyaoo commented 7 years ago

Cordova don't include webkit ! It rely on mobile phone OS; CanIUse says IOS>=7.1 & Android >=4.4 support websocket; Make sure your os version; If you plan to support low version os , follow Crosswalk , or code cordova plugin with native code to connect mosca;

ameykshirsagar commented 7 years ago

@japita-se I have created a native based plugin for Cordova here . It is hosted on my company's repository