Skip to content
A NativeScript plugin for Server-Sent Events
TypeScript Shell JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
demo-server
demo
publish
src
.gitignore
.travis.yml
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
README.md
tslint.json

README.md

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();
You can’t perform that action at this time.