{"_id":"@ardatan/eventsource","_rev":"168766","name":"@ardatan/eventsource","description":"W3C compliant EventSource client for Node.js and browser (polyfill)","dist-tags":{"latest":"1.1.2"},"maintainers":[{"name":"ardatan","email":""}],"time":{"modified":"2021-06-03T11:49:22.000Z","created":"2021-05-02T07:44:15.168Z","1.1.2":"2021-05-02T07:50:27.127Z","1.1.1":"2021-05-02T07:44:15.168Z"},"users":{},"author":{"name":"Aslak Hellesøy","email":"aslak.hellesoy@gmail.com"},"repository":{"type":"git","url":"git://github.com/EventSource/eventsource.git"},"versions":{"1.1.2":{"name":"@ardatan/eventsource","version":"1.1.2","description":"W3C compliant EventSource client for Node.js and browser (polyfill)","keywords":["eventsource","http","streaming","sse","polyfill"],"homepage":"http://github.com/EventSource/eventsource","author":{"name":"Aslak Hellesøy","email":"aslak.hellesoy@gmail.com"},"repository":{"type":"git","url":"git://github.com/EventSource/eventsource.git"},"bugs":{"url":"http://github.com/EventSource/eventsource/issues"},"directories":{"lib":"./lib"},"main":"./lib/eventsource","browser":"./lib/eventsource-browser","license":"MIT","licenses":[{"type":"MIT","url":"http://github.com/EventSource/eventsource/raw/master/LICENSE"}],"devDependencies":{"buffer-from":"^1.1.1","express":"^4.15.3","mocha":"^3.5.3","nyc":"^11.2.1","serve-static":"^1.12.3","ssestream":"^1.0.0","standard":"^10.0.2","webpack":"^3.5.6"},"scripts":{"test":"mocha --reporter spec && standard","polyfill":"webpack lib/eventsource-polyfill.js example/eventsource-polyfill.js","postpublish":"git push && git push --tags","coverage":"nyc --reporter=html --reporter=text _mocha --reporter spec"},"engines":{"node":">=0.12.0"},"dependencies":{"original":"^1.0.0"},"standard":{"ignore":["example/eventsource-polyfill.js"]},"gitHead":"5ef0dc97d81c36ed48cb43aa0831ff69f4010c4d","_id":"@ardatan/eventsource@1.1.2","_nodeVersion":"15.6.0","_npmVersion":"7.4.0","dist":{"shasum":"80c2f3a53a44a0bfe2d6f91f523daf1da0d3d887","size":84492,"noattachment":false,"key":"/@ardatan/eventsource/-/@ardatan/eventsource-1.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/@ardatan/eventsource/download/@ardatan/eventsource-1.1.2.tgz"},"_npmUser":{"name":"ardatan","email":"ardatanrikulu@gmail.com"},"maintainers":[{"name":"ardatan","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eventsource_1.1.2_1619941827000_0.29674532404285037"},"_hasShrinkwrap":false,"publish_time":1619941827127,"_cnpm_publish_time":1619941827127},"1.1.1":{"name":"@ardatan/eventsource","version":"1.1.1","description":"W3C compliant EventSource client for Node.js and browser (polyfill)","keywords":["eventsource","http","streaming","sse","polyfill"],"homepage":"http://github.com/EventSource/eventsource","author":{"name":"Aslak Hellesøy","email":"aslak.hellesoy@gmail.com"},"repository":{"type":"git","url":"git://github.com/EventSource/eventsource.git"},"bugs":{"url":"http://github.com/EventSource/eventsource/issues"},"directories":{"lib":"./lib"},"main":"./lib/eventsource","browser":"./lib/eventsource-browser","license":"MIT","licenses":[{"type":"MIT","url":"http://github.com/EventSource/eventsource/raw/master/LICENSE"}],"devDependencies":{"buffer-from":"^1.1.1","express":"^4.15.3","mocha":"^3.5.3","nyc":"^11.2.1","serve-static":"^1.12.3","ssestream":"^1.0.0","standard":"^10.0.2","webpack":"^3.5.6"},"scripts":{"test":"mocha --reporter spec && standard","polyfill":"webpack lib/eventsource-polyfill.js example/eventsource-polyfill.js","postpublish":"git push && git push --tags","coverage":"nyc --reporter=html --reporter=text _mocha --reporter spec"},"engines":{"node":">=0.12.0"},"dependencies":{"original":"^1.0.0"},"standard":{"ignore":["example/eventsource-polyfill.js"]},"gitHead":"5ef0dc97d81c36ed48cb43aa0831ff69f4010c4d","_id":"@ardatan/eventsource@1.1.1","_nodeVersion":"15.6.0","_npmVersion":"7.4.0","dist":{"shasum":"06778a872b86b0bbfc9cf6f287c60e7d3304f5da","size":84492,"noattachment":false,"key":"/@ardatan/eventsource/-/@ardatan/eventsource-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@ardatan/eventsource/download/@ardatan/eventsource-1.1.1.tgz"},"_npmUser":{"name":"ardatan","email":"ardatanrikulu@gmail.com"},"maintainers":[{"name":"ardatan","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eventsource_1.1.1_1619941454985_0.6347488086608897"},"_hasShrinkwrap":false,"publish_time":1619941455168,"_cnpm_publish_time":1619941455168}},"readme":"# EventSource [![npm version](http://img.shields.io/npm/v/eventsource.svg?style=flat-square)](http://browsenpm.org/package/eventsource)[![NPM Downloads](https://img.shields.io/npm/dm/eventsource.svg?style=flat-square)](http://npm-stat.com/charts.html?package=eventsource&from=2015-09-01)[![Dependencies](https://img.shields.io/david/EventSource/eventsource.svg?style=flat-square)](https://david-dm.org/EventSource/eventsource)\n\nThis library is a pure JavaScript implementation of the [EventSource](https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events) client. The API aims to be W3C compatible.\n\nYou can use it with Node.js or as a browser polyfill for\n[browsers that don't have native `EventSource` support](http://caniuse.com/#feat=eventsource).\n\n## Install\n\n    npm install eventsource\n\n## Example\n\n    npm install\n    node ./example/sse-server.js\n    node ./example/sse-client.js    # Node.js client\n    open http://localhost:8080      # Browser client - both native and polyfill\n    curl http://localhost:8080/sse  # Enjoy the simplicity of SSE\n\n## Browser Polyfill\n\nJust add `example/eventsource-polyfill.js` file to your web page:\n\n```html\n<script src=/eventsource-polyfill.js></script>\n```\n\nNow you will have two global constructors:\n\n```javascript\nwindow.EventSourcePolyfill\nwindow.EventSource // Unchanged if browser has defined it. Otherwise, same as window.EventSourcePolyfill\n```\n\nIf you're using [webpack](https://webpack.github.io/) or [browserify](http://browserify.org/)\nyou can of course build your own. (The `example/eventsource-polyfill.js` is built with webpack).\n\n## Extensions to the W3C API\n\n### Setting HTTP request headers\n\nYou can define custom HTTP headers for the initial HTTP request. This can be useful for e.g. sending cookies\nor to specify an initial `Last-Event-ID` value.\n\nHTTP headers are defined by assigning a `headers` attribute to the optional `eventSourceInitDict` argument:\n\n```javascript\nvar eventSourceInitDict = {headers: {'Cookie': 'test=test'}};\nvar es = new EventSource(url, eventSourceInitDict);\n```\n\n### Allow unauthorized HTTPS requests\n\nBy default, https requests that cannot be authorized will cause the connection to fail and an exception\nto be emitted. You can override this behaviour, along with other https options:\n\n```javascript\nvar eventSourceInitDict = {https: {rejectUnauthorized: false}};\nvar es = new EventSource(url, eventSourceInitDict);\n```\n\nNote that for Node.js < v0.10.x this option has no effect - unauthorized HTTPS requests are *always* allowed.\n\n### HTTP status code on error events\n\nUnauthorized and redirect error status codes (for example 401, 403, 301, 307) are available in the `status` property in the error event.\n\n```javascript\nes.onerror = function (err) {\n  if (err) {\n    if (err.status === 401 || err.status === 403) {\n      console.log('not authorized');\n    }\n  }\n};\n```\n\n### HTTP/HTTPS proxy\n\nYou can define a `proxy` option for the HTTP request to be used. This is typically useful if you are behind a corporate firewall.\n\n```javascript\nvar es = new EventSource(url, {proxy: 'http://your.proxy.com'});\n```\n\n\n## License\n\nMIT-licensed. See LICENSE\n","_attachments":{},"homepage":"http://github.com/EventSource/eventsource","bugs":{"url":"http://github.com/EventSource/eventsource/issues"},"license":"MIT"}