Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

240
Visualizações
Angular 4: zones sockets and change detection

Our application uses sockets, we are using socket.io and its events are wrap with Observables.

In one area of our application we have a graph that updates every 10th of a second. The graph is drawn with D3 and draws directly without using angular.

We would like to disable change detection for the graph area completely and ensure that each socket response (Observable) does not trigger change detection anywhere in the application tree.

We tried using zone.runOutsideAngular, but we had to put it at the lower socket layer where we subscribe to the Observable that wraps socket.io...Although this worked, it runs ALL socket events outside angular. We need to run only the graphing events outside of angular's zone.

Ideally we need to use zones or something at the component level and only for the graphs, because other areas of the application do need change detection from socket events...

It is my understanding that any async operations such as socket events will trigger change detection.

Can we disable this at a higher level without having to touch lower level services?

What is the best approach for running specific socket.io events outside of angular's zone in order to avoid change detection in the whole application?

Any insight would be greatly appreciated.

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda