EventSource issue with Angular 7



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I have migrated from Angular 5 to Angular 7 since then EventSource is not working for me in my application. After googling i found something EventSourcePolyfill so i have imported in my component.



See below: This error i am getting frequently i mean to say for every second.



core.js:12584 ERROR Error: No activity within 1000 milliseconds. Reconnecting.
at eventsource.js:411
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:14134)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
at push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask (zone.js:496)
at ZoneTask.invoke (zone.js:485)
at timer (zone.js:2054)


My question is why EventSource is not working in Angular 7? Is there any other package similar to EventSource.



See below my code:



import EventSourcePolyfill from 'ng-event-source';

ngOnInit()
this.tasks();
this.connect();


tasks()
this.handler.activateLoader();
this.tasksService.get(this.page, this.pageSize).subscribe(results =>
this.handler.hideLoader();
if (this.handler.handle(results))
return;

this.tasksRes = results['data'];
for (let i = 0; i < this.tasksRes.length; i++)
if (this.tasksRes[i].status == 'In_progress' && this.tasksRes[i].eventType == 'Sync' &&
this.tasksRes[i].entityId == this.id)
this.progressFlag = true;
break;
else
this.progressFlag = false;


this.length = results['totalElements'];
, error =>
this.handler.hideLoader();
this.handler.error(error);
);


connect()
let source = new EventSourcePolyfill('/api/v1/events/register', heartbeatTimeout: 1000, connectionTimeout: 1000 );
source.addEventListener('message', message =>
this.tasks();
);



The above code is giving me the error as follows:



enter image description here



Please help me in this issue.










share|improve this question
























  • Can anybody help me out on this issue please?

    – youi
    Nov 19 '18 at 4:10











  • Looks like it cant connect to backend. Can you add screenshot from network?

    – Volodymyr Bilyachat
    Nov 22 '18 at 2:38











  • stackoverflow.com/questions/50449599/…

    – Volodymyr Bilyachat
    Nov 22 '18 at 2:39

















1















I have migrated from Angular 5 to Angular 7 since then EventSource is not working for me in my application. After googling i found something EventSourcePolyfill so i have imported in my component.



See below: This error i am getting frequently i mean to say for every second.



core.js:12584 ERROR Error: No activity within 1000 milliseconds. Reconnecting.
at eventsource.js:411
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:14134)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
at push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask (zone.js:496)
at ZoneTask.invoke (zone.js:485)
at timer (zone.js:2054)


My question is why EventSource is not working in Angular 7? Is there any other package similar to EventSource.



See below my code:



import EventSourcePolyfill from 'ng-event-source';

ngOnInit()
this.tasks();
this.connect();


tasks()
this.handler.activateLoader();
this.tasksService.get(this.page, this.pageSize).subscribe(results =>
this.handler.hideLoader();
if (this.handler.handle(results))
return;

this.tasksRes = results['data'];
for (let i = 0; i < this.tasksRes.length; i++)
if (this.tasksRes[i].status == 'In_progress' && this.tasksRes[i].eventType == 'Sync' &&
this.tasksRes[i].entityId == this.id)
this.progressFlag = true;
break;
else
this.progressFlag = false;


this.length = results['totalElements'];
, error =>
this.handler.hideLoader();
this.handler.error(error);
);


connect()
let source = new EventSourcePolyfill('/api/v1/events/register', heartbeatTimeout: 1000, connectionTimeout: 1000 );
source.addEventListener('message', message =>
this.tasks();
);



The above code is giving me the error as follows:



enter image description here



Please help me in this issue.










share|improve this question
























  • Can anybody help me out on this issue please?

    – youi
    Nov 19 '18 at 4:10











  • Looks like it cant connect to backend. Can you add screenshot from network?

    – Volodymyr Bilyachat
    Nov 22 '18 at 2:38











  • stackoverflow.com/questions/50449599/…

    – Volodymyr Bilyachat
    Nov 22 '18 at 2:39













1












1








1








I have migrated from Angular 5 to Angular 7 since then EventSource is not working for me in my application. After googling i found something EventSourcePolyfill so i have imported in my component.



See below: This error i am getting frequently i mean to say for every second.



core.js:12584 ERROR Error: No activity within 1000 milliseconds. Reconnecting.
at eventsource.js:411
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:14134)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
at push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask (zone.js:496)
at ZoneTask.invoke (zone.js:485)
at timer (zone.js:2054)


My question is why EventSource is not working in Angular 7? Is there any other package similar to EventSource.



See below my code:



import EventSourcePolyfill from 'ng-event-source';

ngOnInit()
this.tasks();
this.connect();


tasks()
this.handler.activateLoader();
this.tasksService.get(this.page, this.pageSize).subscribe(results =>
this.handler.hideLoader();
if (this.handler.handle(results))
return;

this.tasksRes = results['data'];
for (let i = 0; i < this.tasksRes.length; i++)
if (this.tasksRes[i].status == 'In_progress' && this.tasksRes[i].eventType == 'Sync' &&
this.tasksRes[i].entityId == this.id)
this.progressFlag = true;
break;
else
this.progressFlag = false;


this.length = results['totalElements'];
, error =>
this.handler.hideLoader();
this.handler.error(error);
);


connect()
let source = new EventSourcePolyfill('/api/v1/events/register', heartbeatTimeout: 1000, connectionTimeout: 1000 );
source.addEventListener('message', message =>
this.tasks();
);



The above code is giving me the error as follows:



enter image description here



Please help me in this issue.










share|improve this question
















I have migrated from Angular 5 to Angular 7 since then EventSource is not working for me in my application. After googling i found something EventSourcePolyfill so i have imported in my component.



See below: This error i am getting frequently i mean to say for every second.



core.js:12584 ERROR Error: No activity within 1000 milliseconds. Reconnecting.
at eventsource.js:411
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:14134)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
at push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask (zone.js:496)
at ZoneTask.invoke (zone.js:485)
at timer (zone.js:2054)


My question is why EventSource is not working in Angular 7? Is there any other package similar to EventSource.



See below my code:



import EventSourcePolyfill from 'ng-event-source';

ngOnInit()
this.tasks();
this.connect();


tasks()
this.handler.activateLoader();
this.tasksService.get(this.page, this.pageSize).subscribe(results =>
this.handler.hideLoader();
if (this.handler.handle(results))
return;

this.tasksRes = results['data'];
for (let i = 0; i < this.tasksRes.length; i++)
if (this.tasksRes[i].status == 'In_progress' && this.tasksRes[i].eventType == 'Sync' &&
this.tasksRes[i].entityId == this.id)
this.progressFlag = true;
break;
else
this.progressFlag = false;


this.length = results['totalElements'];
, error =>
this.handler.hideLoader();
this.handler.error(error);
);


connect()
let source = new EventSourcePolyfill('/api/v1/events/register', heartbeatTimeout: 1000, connectionTimeout: 1000 );
source.addEventListener('message', message =>
this.tasks();
);



The above code is giving me the error as follows:



enter image description here



Please help me in this issue.







angular typescript angular7 eventsource






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 2:28









Goncalo Peres

1,4771720




1,4771720










asked Nov 16 '18 at 11:42









youiyoui

344315




344315












  • Can anybody help me out on this issue please?

    – youi
    Nov 19 '18 at 4:10











  • Looks like it cant connect to backend. Can you add screenshot from network?

    – Volodymyr Bilyachat
    Nov 22 '18 at 2:38











  • stackoverflow.com/questions/50449599/…

    – Volodymyr Bilyachat
    Nov 22 '18 at 2:39

















  • Can anybody help me out on this issue please?

    – youi
    Nov 19 '18 at 4:10











  • Looks like it cant connect to backend. Can you add screenshot from network?

    – Volodymyr Bilyachat
    Nov 22 '18 at 2:38











  • stackoverflow.com/questions/50449599/…

    – Volodymyr Bilyachat
    Nov 22 '18 at 2:39
















Can anybody help me out on this issue please?

– youi
Nov 19 '18 at 4:10





Can anybody help me out on this issue please?

– youi
Nov 19 '18 at 4:10













Looks like it cant connect to backend. Can you add screenshot from network?

– Volodymyr Bilyachat
Nov 22 '18 at 2:38





Looks like it cant connect to backend. Can you add screenshot from network?

– Volodymyr Bilyachat
Nov 22 '18 at 2:38













stackoverflow.com/questions/50449599/…

– Volodymyr Bilyachat
Nov 22 '18 at 2:39





stackoverflow.com/questions/50449599/…

– Volodymyr Bilyachat
Nov 22 '18 at 2:39












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53337179%2feventsource-issue-with-angular-7%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53337179%2feventsource-issue-with-angular-7%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

政党

天津地下鉄3号線