taro-sse
v0.0.4
Published
A server-sent events client for Taro
Downloads
3
Readme
taro-sse
A server-sent events client for Taro
Usage
npm install taro-sse --save
import SSE from 'taro-sse';
const sse = new SSE({
url: 'http://localhost:3000/sse',
});
sse.on('message', (data) => {
console.log(data);
});
sse.on('open', () => {
console.log('open');
});
sse.on('error', (err) => {
console.log(err);
});
sse.on('close', () => {
console.log('close');
});
sse.connect();