Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

224
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!