Socket
Socket
Sign inDemoInstall

eventsource

Package Overview
Dependencies
4
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.0 to 0.2.1

85

History.md

@@ -1,78 +0,85 @@

# [Unreleased](https://github.com/aslakhellesoy/eventsource-node/compare/v0.1.6...v0.2.0)
# [0.2.1](https://github.com/aslakhellesoy/eventsource/compare/v0.2.0...v0.2.1)
* Fix `close()` for polyfill. ([#52](https://github.com/aslakhellesoy/eventsource/pull/52) brian-medendorp)
* Add http/https proxy function. ([#46](https://github.com/aslakhellesoy/eventsource/pull/46) Eric Lu)
* Fix reconnect for polyfill. Only disable reconnect when server status is 204. (Aslak Hellesøy).
* Drop support for Node 0.10.x and older (Aslak Hellesøy).
# [0.2.0](https://github.com/aslakhellesoy/eventsource/compare/v0.1.6...v0.2.0)
* Renamed repository to `eventsource` (since it's not just Node, but also browser polyfill). (Aslak Hellesøy).
* Compatibility with webpack/browserify. ([#44](https://github.com/aslakhellesoy/eventsource-node/pull/44) Adriano Raiano).
* Compatibility with webpack/browserify. ([#44](https://github.com/aslakhellesoy/eventsource/pull/44) Adriano Raiano).
# [0.1.6](https://github.com/aslakhellesoy/eventsource-node/compare/v0.1.5...v0.1.6)
# [0.1.6](https://github.com/aslakhellesoy/eventsource/compare/v0.1.5...v0.1.6)
* Ignore headers without a value. ([#41](https://github.com/aslakhellesoy/eventsource-node/issues/41), [#43](https://github.com/aslakhellesoy/eventsource-node/pull/43) Adriano Raiano)
* Ignore headers without a value. ([#41](https://github.com/aslakhellesoy/eventsource/issues/41), [#43](https://github.com/aslakhellesoy/eventsource/pull/43) Adriano Raiano)
# [0.1.5](https://github.com/aslakhellesoy/eventsource-node/compare/v0.1.4...v0.1.5)
# [0.1.5](https://github.com/aslakhellesoy/eventsource/compare/v0.1.4...v0.1.5)
* Refactor tests to support Node.js 0.12.0 and Io.js 1.1.0. (Aslak Hellesøy)
# [0.1.4](https://github.com/aslakhellesoy/eventsource-node/compare/v0.1.3...master)
# [0.1.4](https://github.com/aslakhellesoy/eventsource/compare/v0.1.3...master)
* Bugfix: Added missing origin property. ([#39](https://github.com/aslakhellesoy/eventsource-node/pull/39), [#38](https://github.com/aslakhellesoy/eventsource-node/issues/38) Arnout Kazemier)
* Expose `status` property on `error` events. ([#40](https://github.com/aslakhellesoy/eventsource-node/pull/40) Adriano Raiano)
* Bugfix: Added missing origin property. ([#39](https://github.com/aslakhellesoy/eventsource/pull/39), [#38](https://github.com/aslakhellesoy/eventsource/issues/38) Arnout Kazemier)
* Expose `status` property on `error` events. ([#40](https://github.com/aslakhellesoy/eventsource/pull/40) Adriano Raiano)
# [0.1.3](https://github.com/aslakhellesoy/eventsource-node/compare/v0.1.2...v0.1.3)
# [0.1.3](https://github.com/aslakhellesoy/eventsource/compare/v0.1.2...v0.1.3)
* Bugfix: Made message properties enumerable. ([#37](https://github.com/aslakhellesoy/eventsource-node/pull/37) Golo Roden)
* Bugfix: Made message properties enumerable. ([#37](https://github.com/aslakhellesoy/eventsource/pull/37) Golo Roden)
# [0.1.2](https://github.com/aslakhellesoy/eventsource-node/compare/v0.1.1...v0.1.2)
# [0.1.2](https://github.com/aslakhellesoy/eventsource/compare/v0.1.1...v0.1.2)
* Bugfix: Blank lines not read. ([#35](https://github.com/aslakhellesoy/eventsource-node/issues/35), [#36](https://github.com/aslakhellesoy/eventsource-node/pull/36) Lesterpig)
* Bugfix: Blank lines not read. ([#35](https://github.com/aslakhellesoy/eventsource/issues/35), [#36](https://github.com/aslakhellesoy/eventsource/pull/36) Lesterpig)
# [0.1.1](https://github.com/aslakhellesoy/eventsource-node/compare/v0.1.0...v0.1.1)
# [0.1.1](https://github.com/aslakhellesoy/eventsource/compare/v0.1.0...v0.1.1)
* Bugfix: Fix message type. ([#33](https://github.com/aslakhellesoy/eventsource-node/pull/33) Romain Gauthier)
* Bugfix: Fix message type. ([#33](https://github.com/aslakhellesoy/eventsource/pull/33) Romain Gauthier)
# [0.1.0](https://github.com/aslakhellesoy/eventsource-node/compare/v0.0.10...v0.1.0)
# [0.1.0](https://github.com/aslakhellesoy/eventsource/compare/v0.0.10...v0.1.0)
* Bugfix: High CPU usage by replacing Jison with port of WebKit's parser. ([#25](https://github.com/aslakhellesoy/eventsource-node/issues/25), [#32](https://github.com/aslakhellesoy/eventsource-node/pull/32), [#18](https://github.com/aslakhellesoy/eventsource-node/issues/18) qqueue)
* Bugfix: High CPU usage by replacing Jison with port of WebKit's parser. ([#25](https://github.com/aslakhellesoy/eventsource/issues/25), [#32](https://github.com/aslakhellesoy/eventsource/pull/32), [#18](https://github.com/aslakhellesoy/eventsource/issues/18) qqueue)
* Reformatted all code to 2 spaces.
# [0.0.10](https://github.com/aslakhellesoy/eventsource-node/compare/v0.0.9...v0.0.10)
# [0.0.10](https://github.com/aslakhellesoy/eventsource/compare/v0.0.9...v0.0.10)
* Provide `Event` argument on `open` and `error` event ([#30](https://github.com/aslakhellesoy/eventsource-node/issues/30), [#31](https://github.com/aslakhellesoy/eventsource-node/pull/31) Donghwan Kim)
* Expose `lastEventId` on messages. ([#28](https://github.com/aslakhellesoy/eventsource-node/pull/28) mbieser)
* Provide `Event` argument on `open` and `error` event ([#30](https://github.com/aslakhellesoy/eventsource/issues/30), [#31](https://github.com/aslakhellesoy/eventsource/pull/31) Donghwan Kim)
* Expose `lastEventId` on messages. ([#28](https://github.com/aslakhellesoy/eventsource/pull/28) mbieser)
# [0.0.9](https://github.com/aslakhellesoy/eventsource-node/compare/v0.0.8...v0.0.9)
# [0.0.9](https://github.com/aslakhellesoy/eventsource/compare/v0.0.8...v0.0.9)
* Bugfix: old "last-event-id" used on reconnect ([#27](https://github.com/aslakhellesoy/eventsource-node/pull/27) Aslak Hellesøy)
* Bugfix: old "last-event-id" used on reconnect ([#27](https://github.com/aslakhellesoy/eventsource/pull/27) Aslak Hellesøy)
# [0.0.8](https://github.com/aslakhellesoy/eventsource-node/compare/v0.0.7...v0.0.8)
# [0.0.8](https://github.com/aslakhellesoy/eventsource/compare/v0.0.7...v0.0.8)
* Bugfix: EventSource still reconnected when closed ([#24](https://github.com/aslakhellesoy/eventsource-node/pull/24) FrozenCow)
* Bugfix: EventSource still reconnected when closed ([#24](https://github.com/aslakhellesoy/eventsource/pull/24) FrozenCow)
* Allow unauthorized HTTPS connections by setting `rejectUnauthorized` to false. (Aslak Hellesøy)
# [0.0.7](https://github.com/aslakhellesoy/eventsource-node/compare/v0.0.6...v0.0.7)
# [0.0.7](https://github.com/aslakhellesoy/eventsource/compare/v0.0.6...v0.0.7)
* Explicitly raise an error when server returns http 403 and don't continue ([#20](https://github.com/aslakhellesoy/eventsource-node/pull/20) Scott Moak)
* Added ability to send custom http headers to server ([#21](https://github.com/aslakhellesoy/eventsource-node/pull/21), [#9](https://github.com/aslakhellesoy/eventsource-node/issues/9) Scott Moak)
* Fix Unicode support to cope with Javascript Unicode size limitations ([#23](https://github.com/aslakhellesoy/eventsource-node/pull/23), [#22](https://github.com/aslakhellesoy/eventsource-node/issues/22) Devon Adkisson)
* Graceful handling of parse errors ([#19](https://github.com/aslakhellesoy/eventsource-node/issues/19) Aslak Hellesøy)
* Explicitly raise an error when server returns http 403 and don't continue ([#20](https://github.com/aslakhellesoy/eventsource/pull/20) Scott Moak)
* Added ability to send custom http headers to server ([#21](https://github.com/aslakhellesoy/eventsource/pull/21), [#9](https://github.com/aslakhellesoy/eventsource/issues/9) Scott Moak)
* Fix Unicode support to cope with Javascript Unicode size limitations ([#23](https://github.com/aslakhellesoy/eventsource/pull/23), [#22](https://github.com/aslakhellesoy/eventsource/issues/22) Devon Adkisson)
* Graceful handling of parse errors ([#19](https://github.com/aslakhellesoy/eventsource/issues/19) Aslak Hellesøy)
* Switched from testing with Nodeunit to Mocha (Aslak Hellesøy)
# [0.0.6](https://github.com/aslakhellesoy/eventsource-node/compare/v0.0.5...v0.0.6)
# [0.0.6](https://github.com/aslakhellesoy/eventsource/compare/v0.0.5...v0.0.6)
* Add Accept: text/event-stream header ([#17](https://github.com/aslakhellesoy/eventsource-node/pull/17) William Wicks)
* Add Accept: text/event-stream header ([#17](https://github.com/aslakhellesoy/eventsource/pull/17) William Wicks)
# [0.0.5](https://github.com/aslakhellesoy/eventsource-node/compare/v0.0.4...v0.0.5)
# [0.0.5](https://github.com/aslakhellesoy/eventsource/compare/v0.0.4...v0.0.5)
* Add no-cache and https support ([#10](https://github.com/aslakhellesoy/eventsource-node/pull/10) Einar Otto Stangvik)
* Ensure that Last-Event-ID is sent to the server for reconnects, as defined in the spec ([#8](https://github.com/aslakhellesoy/eventsource-node/pull/8) Einar Otto Stangvik)
* Verify that CR and CRLF are accepted alongside LF ([#7](https://github.com/aslakhellesoy/eventsource-node/pull/7) Einar Otto Stangvik)
* Emit 'open' event ([#4](https://github.com/aslakhellesoy/eventsource-node/issues/4) Einar Otto Stangvik)
* Add no-cache and https support ([#10](https://github.com/aslakhellesoy/eventsource/pull/10) Einar Otto Stangvik)
* Ensure that Last-Event-ID is sent to the server for reconnects, as defined in the spec ([#8](https://github.com/aslakhellesoy/eventsource/pull/8) Einar Otto Stangvik)
* Verify that CR and CRLF are accepted alongside LF ([#7](https://github.com/aslakhellesoy/eventsource/pull/7) Einar Otto Stangvik)
* Emit 'open' event ([#4](https://github.com/aslakhellesoy/eventsource/issues/4) Einar Otto Stangvik)
# [0.0.4](https://github.com/aslakhellesoy/eventsource-node/compare/v0.0.3...v0.0.4)
# [0.0.4](https://github.com/aslakhellesoy/eventsource/compare/v0.0.3...v0.0.4)
* Automatic reconnect every second if the server is down. Reconnect interval can be set with `reconnectInterval` (not in W3C spec). (Aslak Hellesøy)
# [0.0.3](https://github.com/aslakhellesoy/eventsource-node/compare/v0.0.2...v0.0.3)
# [0.0.3](https://github.com/aslakhellesoy/eventsource/compare/v0.0.2...v0.0.3)
* Jison based eventstream parser ([#2](https://github.com/aslakhellesoy/eventsource-node/pull/2) Einar Otto Stangvik)
* Jison based eventstream parser ([#2](https://github.com/aslakhellesoy/eventsource/pull/2) Einar Otto Stangvik)
# [0.0.2](https://github.com/aslakhellesoy/eventsource-node/compare/v0.0.1...v0.0.2)
# [0.0.2](https://github.com/aslakhellesoy/eventsource/compare/v0.0.1...v0.0.2)

@@ -79,0 +86,0 @@ * Use native EventListener (Aslak Hellesøy)

@@ -16,3 +16,3 @@ var original = require('original')

* @param {String} url the URL to which to connect
* @param {Object} eventSourceInitDict extra init params. See README for details.
* @param {Object} [eventSourceInitDict] extra init params. See README for details.
* @api public

@@ -36,7 +36,5 @@ **/

self.reconnectInterval = 1000;
var connectPending = false;
function onConnectionClosed() {
if (connectPending || readyState === EventSource.CLOSED) return;
connectPending = true;
if (readyState === EventSource.CLOSED) return;
readyState = EventSource.CONNECTING;

@@ -73,3 +71,2 @@ _emit('error', new Event('error'));

function connect() {
connectPending = false;

@@ -91,2 +88,13 @@ var options = parse(url);

// If specify http proxy, make the request to sent to the proxy server,
// and include the original url in path and Host headers
if (eventSourceInitDict && eventSourceInitDict.proxy) {
var proxy = parse(eventSourceInitDict.proxy);
options.path = url;
options.headers.Host = options.host;
options.hostname = proxy.hostname;
options.host = proxy.host;
options.port = proxy.port;
}
req = (isSecure ? https : http).request(options, function (res) {

@@ -108,3 +116,4 @@ // Handle HTTP redirects

_emit('error', new Event('error', {status: res.statusCode}));
return self.close();
if (res.statusCode == 204) return self.close();
return
}

@@ -185,2 +194,3 @@

if (req.abort) req.abort();
if (req.xhr && req.xhr.abort) req.xhr.abort();
};

@@ -187,0 +197,0 @@

{
"name": "eventsource",
"version": "0.2.0",
"description": "W3C compliant EventSource client for Node.js",
"version": "0.2.1",
"description": "W3C compliant EventSource client for Node.js and browser (polyfill)",
"keywords": [

@@ -9,12 +9,13 @@ "eventsource",

"streaming",
"sse"
"sse",
"polyfill"
],
"homepage": "http://github.com/aslakhellesoy/eventsource-node",
"homepage": "http://github.com/aslakhellesoy/eventsource",
"author": "Aslak Hellesøy <aslak.hellesoy@gmail.com>",
"repository": {
"type": "git",
"url": "git://github.com/aslakhellesoy/eventsource-node.git"
"url": "git://github.com/aslakhellesoy/eventsource.git"
},
"bugs": {
"url": "http://github.com/aslakhellesoy/eventsource-node/issues"
"url": "http://github.com/aslakhellesoy/eventsource/issues"
},

@@ -29,3 +30,3 @@ "directories": {

"type": "MIT",
"url": "http://github.com/aslakhellesoy/eventsource-node/raw/master/LICENSE"
"url": "http://github.com/aslakhellesoy/eventsource/raw/master/LICENSE"
}

@@ -38,3 +39,3 @@ ],

"sse": "^0.0.6",
"webpack": "^1.12.13"
"webpack": "^1.12.14"
},

@@ -41,0 +42,0 @@ "scripts": {

@@ -1,4 +0,3 @@

# EventSource [![Build Status](https://secure.travis-ci.org/aslakhellesoy/eventsource-node.png)](http://travis-ci.org/aslakhellesoy/eventsource-node) [![Dependencies](https://david-dm.org/aslakhellesoy/eventsource-node.png)](https://david-dm.org/aslakhellesoy/eventsource-node) [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/aslakhellesoy/eventsource-node/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
# EventSource [![Build Status](https://secure.travis-ci.org/aslakhellesoy/eventsource.svg)](http://travis-ci.org/aslakhellesoy/eventsource) [![Dependencies](https://david-dm.org/aslakhellesoy/eventsource.svg)](https://david-dm.org/aslakhellesoy/eventsource)
[![NPM](https://nodei.co/npm/eventsource.png?stars&downloads)](https://nodei.co/npm/eventsource/)

@@ -20,5 +19,5 @@ [![NPM](https://nodei.co/npm-dl/eventsource.png)](https://nodei.co/npm/eventsource/)

node ./example/sse-server.js
node ./example/sse-client.js (Node.js client)
open http://localhost:8080 (Browser client - both native and polyfill)
curl http://localhost:8080/sse (Enjoy the simplicity of SSE)
node ./example/sse-client.js # Node.js client
open http://localhost:8080 # Browser client - both native and polyfill
curl http://localhost:8080/sse # Enjoy the simplicity of SSE)

@@ -82,1 +81,9 @@ ## Browser Polyfill

```
### HTTP/HTTPS proxy
You can define a `proxy` option for the HTTP request to be used. This is typically useful if you are behind a corporate firewall.
```javascript
var es = new EventSource(url, { proxy: 'http://your.proxy.com' });
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc