File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -362,10 +362,16 @@ a JWT containing at least one target marking the update to the Hub.
362
362
363
363
To provide this JWT, the subscriber can use a cookie,
364
364
or a ``Authorization `` HTTP header.
365
- Cookies are automatically sent by the browsers when opening an ``EventSource `` connection.
365
+ Cookies are automatically sent by the browsers when opening an ``EventSource `` connection if the `` withCredentials `` attribute is set to `` true `` .
366
366
Using cookies is the most secure and preferred way when the client is a web browser.
367
367
If the client is not a web browser, then using an authorization header is the way to go.
368
368
369
+ .. code-block :: javascript
370
+
371
+ const eventSource = new EventSource (hub, {
372
+ withCredentials: true
373
+ });
374
+
369
375
.. tip ::
370
376
371
377
The native implementation of EventSource doesn't allow specifying headers.
You can’t perform that action at this time.
0 commit comments