mkuklis / phonegap-websocket

Websocket PhoneGap plugin for Android
203 stars 78 forks source link

Is require('cordova/exec') needed in phonegap-websocket.js ? #39

Closed drdanmorris closed 10 years ago

drdanmorris commented 10 years ago

Hi

In order to get this plugin to work I needed to comment-out the...

require('cordova/exec') 

...call at the top of phonegap-websocket.js. Now, this may be due to the fact that I had to manually load the phonegap-websocket.js script because Phonegap refused to inject it for some reason. However, I can't see how this call would work, as the require() method is declared within a closure in phonegap.js.

Anyway, apart from that I'm very glad to have a working websocket in JellyBean now. Regards, Daniel.

mkuklis commented 10 years ago

Daniel you should load it via phonegap or wrap it with:

cordova.define("com.ququplay.websocket.WebSocket.websocket", function(require, exports, module) {
 // plugin here
});

That's what Phonegap does when you install any plugin via their cmd client.

drdanmorris commented 10 years ago

Hi Michal

Yep - ok, that makes sense. I was trying to use the .js straight from your repo rather than how phonegap would present it. Anyway, all working now.

Thanks for the quick reply.

Regards, Daniel.

On Tue, Feb 4, 2014 at 3:30 AM, Michał Kuklis notifications@github.comwrote:

Daniel you should load it via phonegap or wrap it with:

cordova.define("com.ququplay.websocket.WebSocket.websocket", function(require, exports, module) { // puglin here});

That's what Phonegap does when you install any plugin via their cmd line.

— Reply to this email directly or view it on GitHubhttps://github.com/mkuklis/phonegap-websocket/issues/39#issuecomment-33958606 .

mkuklis commented 10 years ago

@drdanmorris I'm glad things work for you now. Cheers.