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

223
Visualizações
is this a valid way to get the latency from websocket connection?

I am trying to measure the latency when data are sent to the client from the server. My approach is calculating the difference between the server side and client side timestamp. Would this be a valid approach?

server.js

const timestamp = new Date().getTime()
io.emit('get_data', data, timestamp)

client.js

  const [latency, setLatency] = useState(0)
  (...)
  useEffect(() => {
    socket.on('get_data', (res, sentTime) => {
      const currentTime = new Date().getTime()
      const latency = currentTime - sentTime
    },[socket])
about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

I think this is not a good approach to measuring performance. This is a manual approach and you will not get the best estimation. Generally, we calculate performance based on statistics. The more sample you add to your test, you will get the better the estimation. I think load-testing is a good technique to stress the server. JMeter is probably the best option to perform load-testing.

about 4 years ago · Santiago Gelvez Relatório
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