becvert / cordova-plugin-websocket-server

Cordova WebSocket Server Plugin
MIT License
84 stars 35 forks source link

Support for Observables #63

Open myin142 opened 4 years ago

myin142 commented 4 years ago

I want to create a ionic-native plugin for this cordova plugin. But the support for observable/promise does not seem to be considered. For example returning 2 values on start is not supported by observables/promises. And using callbacks does not seem normal for ionic/angular.

So I would like to change the code to better support observables and move the callback functions to actual functions. But that would be a huge change of the code. I do not know if it would be acceptable for such a change. If not, I would just use my fork for my project.

becvert commented 4 years ago

Feel free to make a Pull Request then we'll see.

You can return multiple values in Promise, for instance: Promise.resolve([1,2]).then(([arg1,arg2]) => console.log('result', arg1, arg2)) Does this help?

myin142 commented 4 years ago

Yes it did seem to return 2 values, but I will still try to change it. Observables are better IMO for Ionic/Angular. The only problem is, I have no idea how to program or test iOS. I neither have an iPhone to test it with nor an Mac to build it. We'll see how it works