Skip to content

Commit 3fb1350

Browse files
author
Joe Goggins
committed
Add options to EventStream constructor with blank header default key
1 parent b8104b7 commit 3fb1350

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/EventStream.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,23 @@ import url from 'url';
55
import { EventEmitter } from 'events';
66

77
class EventStream extends EventEmitter {
8-
constructor(uri, token) {
8+
/**
9+
*
10+
* @param {String} uri Event stream URL
11+
* @param {String} token Particle Access Token
12+
* @param {Object} options
13+
* @param {Particle} options.headers key/val http headers to pass along
14+
* @hideconstructor
15+
*/
16+
constructor(uri, token, options={ headers:{} }) {
917
super();
1018
this.uri = uri;
1119
this.token = token;
1220
this.reconnectInterval = 2000;
1321
this.timeout = 13000; // keep alive can be sent up to 12 seconds after last event
1422
this.data = '';
1523
this.buf = '';
24+
this.options = options;
1625

1726
this.parse = this.parse.bind(this);
1827
this.end = this.end.bind(this);

0 commit comments

Comments
 (0)