You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -128,6 +128,14 @@ By default, EventSource makes a `GET` request. You can specify a different HTTP
128
128
var eventSourceInitDict = { method:'POST', body:'n=100' };
129
129
```
130
130
131
+
### Read timeout
132
+
133
+
TCP connections can sometimes fail without the client detecting an I/O error, in which case EventSource could hang forever waiting for events. Setting a `readTimeoutMillis` will cause EventSource to drop and retry the connection if that number of milliseconds ever elapses without receiving any new data from the server. If the server is known to send any "heartbeat" data at regular intervals (such as a `:` comment line, which is ignored in SSE) to indicate that the connection is still alive, set the read timeout to some number longer than that interval.
134
+
135
+
```javascript
136
+
var eventSourceInitDict = { readTimeoutMillis:30000 };
137
+
````
138
+
131
139
### Special HTTPS configuration
132
140
133
141
In Node.js, you can customize the behavior ofHTTPS requests by specifying, for instance, additional trusted CAcertificates. You may use any of the special TLS options supported by Node's [`tls.connect()`](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback) and [`tls.createSecureContext()`](https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options) (depending on what version of Node you are using) by putting them in an object in the `https` property of your configuration:
0 commit comments