nativescript-sse
TypeScript icon, indicating that this package has built-in type declarations

4.0.2 • Public • Published

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(serverApistring, headersobject);
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();

Package Sidebar

Install

npm i nativescript-sse

Weekly Downloads

9

Version

4.0.2

License

Apache-2.0

Unpacked Size

27 kB

Total Files

15

Last publish

Collaborators

  • triniwiz