I have Angular Web application which I want to run as an Android app, using NativeScript.
For the websocket to work on Android, I'm using nativescript-websockets
tns plugin add nativescript-websockets
This works on the Android app.
require("nativescript-websockets");
this.websocket = new WebSocket("myUrl, "myProtocol");
I've added the above in a service which creates a websocket to the server.
But when I'm trying the run for web, I get the error:
Module not found: Error: Can't resolve 'nativescript-websockets'
When I remove require("nativescript-websockets"); from the service, it works for web.
What changes would I need such that it works for both Web and Mobile?