Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions client.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,19 @@ function EventSourceWrapper() {
}

function getEventSourceWrapper() {
if (!window.__whmEventSourceWrapper) {
window.__whmEventSourceWrapper = {};
var top = window;
if (window.self !== window.top) {
top = window.top;
}
if (!window.__whmEventSourceWrapper[options.path]) {
if (!top.__whmEventSourceWrapper) {
top.__whmEventSourceWrapper = {};
}
if (!top.__whmEventSourceWrapper[options.path]) {
// cache the wrapper for other entries loaded on
// the same page with the same options.path
window.__whmEventSourceWrapper[options.path] = EventSourceWrapper();
top.__whmEventSourceWrapper[options.path] = EventSourceWrapper();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should not keep it cached now. e.g. On this reload server is closing web socket connection
module.hot.accept() => { window.location.reload(); });
while when creating new EventSourceWrapper(); it work properly.

}
return window.__whmEventSourceWrapper[options.path];
return top.__whmEventSourceWrapper[options.path];
}

function connect() {
Expand Down