Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

124
Vistas
Angular 10 JWT asp.net core display user online status realtime

Im using angular 10 as my frontend and asp.net core as my backend. I use jwt as my user authentication method. User posts its username and password to the server side and server generates a token sending it back to the user. And I save the token in user's browser local storage. I have written an http interceptor which adds authorization bearer to the header section of user's api requests. This is the way server knows who is who. Now I have a page in which I should display online and offline users with green and red dots next to their names. I can know when a user signs in because it has to login and I can do whateverI want when user signs in but I dont know how to let my client know when users close their browser and leave the site. I am looking for any library, logic or anything to know my user's online/offline status realtime. I should display which users are online and which are not and it should be realtime. I use microsoft identity context to handle membership. Any help is appreciated. Thank you. I need to add that I want a solution rather than code. I just want to know how to do it. I can handle the code work myself. I just want to know how?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Using a web application to know live information about other users sessions will require the server to publish the other user's data in some way.

One approach would be to use a framework to handle server initiate communication via websockets. This would require something like SignalR, for your ASP.NET Core application, for your server to push the user changes. Using websockets is not hard, but it comes with a steep learning curve and more server requirements to attend to.

As Second approach would be to periodically pull the information about the other users (someone called it "hearbeat request" on the question comments). In this approach you create a normal endpoint on your app, and have your front-end page periodically call it to update the user's info. This is much simpler then websockets to implement, and does not add requirements to your current infrastructure.

The difference on the approaches is how close you get to real-time, and the effort to implement it.

  • With websockets the server would push the user session changes as they occur, there cannot be more real-time then this.
  • Without websockets the client would have to keep pulling the user changes, so in the time between pull's you loose some "real-time".
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda