Expand ionic native plugins

Hello ! I’m making first attempts to realize app mobile with ionic 3-angular and cordova 8.
My need is to build a tcp socket plugin raw (not chrome plugin).
I think i could have three ways to do this:

  1. Build a plugin from zero (I dont think to be able)
  2. download a cordova plugin as “cz.blocshop.socketsforcordova” but it has been developed in old style and it seems not to be compliant with the rest of my project (typescript or ES6) and object “Socket” is not visible from my application
  3. download a native ionic plugin (for example SMS) and modify it inserting other function (example open_tcp, close_tcp, send_tcp, receive_tcp…).

The last one seems to be the best way to go for me, but i found problems in modifying files in “node_modules” @ionic-native/sms folder.
There are interfacing files “index.d.ts, index.js, index.metadata.json” that need to be modified at the same way.

So my question is:
Are ionic native plugins as “sms” modifiable. And if Yes, which is the best way to do this.

Thank you everyone can help me !!!


You can definitely modify them, I’ve needed to before, but in my case I only had to modify the Android portion.

I’d say option 2 is actually probably your best bet if the plugin works, which it sounds like from your description maybe it doesn’t. Still, if you can find one, it would be far easier to wrap an existing plugin in promises in a service or something.

If you need to modify the plugin itself, you will need to get the code from the github repo for the project (as opposed to just what you get from npm, although it might also contain the dev version of the code).

You’d then have to update the java code for Android and the Objective C code for iOS, and then the actual plugin part. There are tutorials out there for making cordova plugins if you do in fact want to go that far.

1 Like

Thanks rlouie for your time and your suggestions.
It’s hard but i will let you know if i take steps forward.