nativescript-sse
by triniwiz | v4.0.2
A NativeScript client for the Server Sent Events (SSE)
npm i --save nativescript-sse

NativeScript Server Sent Events

npm npm Build Status

A NativeScript client for the Server Sent Events (SSE).

Install

npm install nativescript-sse

Usage

import { SSE } from 'nativescript-sse';

let sse = new SSE(serverApi: string, headers: object);
sse.events.on('onConnect', (data) => {
console.log(data.object.connected);
});
sse.events.on('onMessage', (data) => {
this.list.push(JSON.parse(data.object.message.data))
});
sse.events.on('onError', (data) => {
console.log(data.object.error);
});
see.close();