slact / nchan.js

NPM package for the Javasript client for Nchan
Other
91 stars 25 forks source link

There should be an option for EventSource withCredentials (keyword CORS) #9

Open Revisor opened 6 years ago

Revisor commented 6 years ago

Hi, thanks for the great module and the accompanying JS library.

Right now it is not possible to initiate an EventSource connection with the withCredentials: true parameter.

The line 673 looks like this

this.listener = new EventSource(url);

Since the CORS intent must be indicated in the constructor and not later, it must be solved on this line.

this.listener = new EventSource(url, { withCredentials: true });

Users would probably want to have a choice, so maybe pass it through the opt array?

Thank you.

slact commented 6 years ago

supported in master as of commit f8b276f9c58be7a5c38202933ccdbf8bc019c40d