Select to view content in your preferred language

Socket.io is crashing the page as the applyEdits() method calls to get data in near real-time

809
1
Jump to solution
02-14-2023 09:40 PM
kawishabbas
Regular Contributor

Hi,

As I stated in my subject, I want to use socket.io to get real-time alerts from ONT devices. Everything is going good, I am receiving real-time alerts on server side and also get those alerts on my web page. But, I have a confusion, as is apply applyEdits() method on my GEOJSON layer to remove and add the points within real-time (or as the alert receive)  then my web page crashed.

I hope community members are understanding my point. For the better understanding, I attached the code as a zip file. 

Please anyone from the community can help me to resolve this issue.?

 

Note: For front-end I am using react.js and esri-loader for mapping capabilities.

Regards,

Kawish

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hi there, 

ApplyEdits is not meant to be used for near realtime updates. Although, the app could be crashing for other reasons. I can't be sure. 

In any case, have you tried using StreamLayer for your use case?  The stream layer can consume a service from a custom web socket. Seems like this option could work for you. 

At 4.26, we are also introducing client-side StreamLayer where you can stream features to the layer on the client-side. You can test this new capability using our next version and you can find more info here.

View solution in original post

0 Kudos
1 Reply
UndralBatsukh
Esri Regular Contributor

Hi there, 

ApplyEdits is not meant to be used for near realtime updates. Although, the app could be crashing for other reasons. I can't be sure. 

In any case, have you tried using StreamLayer for your use case?  The stream layer can consume a service from a custom web socket. Seems like this option could work for you. 

At 4.26, we are also introducing client-side StreamLayer where you can stream features to the layer on the client-side. You can test this new capability using our next version and you can find more info here.

0 Kudos