File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -364,10 +364,17 @@ a JWT containing a topic selector matching by the update's topic.
364364
365365To provide this JWT, the subscriber can use a cookie,
366366or a ``Authorization `` HTTP header.
367- Cookies are automatically sent by the browsers when opening an ``EventSource `` connection.
367+
368+ Cookies are automatically sent by the browsers when opening an ``EventSource `` connection if the ``withCredentials `` attribute is set to ``true ``.
368369Using cookies is the most secure and preferred way when the client is a web browser.
369370If the client is not a web browser, then using an authorization header is the way to go.
370371
372+ .. code-block :: javascript
373+
374+ const eventSource = new EventSource (hub, {
375+ withCredentials: true
376+ });
377+
371378 .. tip ::
372379
373380 The native implementation of EventSource doesn't allow specifying headers.
You can’t perform that action at this time.
0 commit comments