0.2.8 • Published 4 years ago

cordova-plugin-socket-service v0.2.8

Weekly downloads
2
License
ISC
Repository
-
Last release
4 years ago

cordova-plugin-socket-service

Cordova plugin for Socket.io sdk


how to use

Import : declare var SocketService: any;

/***/

let url_notif = '......';

Starting the service:

	SocketService.startService(this.url_notif,args0,args1, (data) => {
			console.log('SocketService OK ',data);
		},
		(err) => {
		console.log('SocketService eRR ',err);
		}
	);

Stopping the service:

	SocketService.stopService();

Listeners

Listeners listen for incoming messages in the background service. If the application is in the foreground when the message comes in, the message is broadcasted to Cordova and recieved by the listener.

Adding a listener:

	SocketService.addEventListener("incoming.event", (data) => {
		console.log("incoming.event",data); 
   	});

Sending a message

	SocketService.fireNativeEvent( 'outgoing.event',
		{
		event: "register",
		data: {}
		}
	);

Wake-up functionality

If the application is in the background, or killed, when the message comes in, then the background service will show a popup notification. Clicking the notification will start the application. Once the application is started again, check that it was started by the background service:

 	SocketService.hasParam("data", (data) => {
		console.log("hasParam event",data);
	});

And receive the incoming message:

	SocketService.getParam("data", (data) => {
		console.log("getParam event",JSON.parse(data));
	});

how to build for ionic

ionic cordova plugin add cordova-plugin-socket-service

ionic cordova build android
0.2.8

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.4

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago