question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

is there a way to listen for the heartbeat?

See original GitHub issue

is there a way to listen for the heartbeat event?

i would like to do a store.session.touch(); during this event

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Reactions:2
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

16reactions
cablemancommented, Jun 18, 2014

If you have the socket connection you can get the heartbeat event by:

socketio.on('connection', function(socket) {
  socket.conn.on('heartbeat', function() {
      console.log('heartbeat');
    });
});

But as above I don’t know if this is the official way to do it!

Note this is for socket.io 1.0.x.

7reactions
3rd-Edencommented, May 9, 2013
var handler = socket.manager.transports[socket.id].onMessage;
socket.manager.transports[socket.id].onMessage = function (packet) {
 handler.apply(this, arguments);

 if (packet.type === 'heartbeat') doStuff(); 
}

I don’t want to sound like a dick here but have you guys even taken the time to look at the source code? This is an open source project, there’s no magic, unicorns, compiled coffeescript garbage or secrets. All the answers you guys are searching for is just in the source. Instead of typing +1 just read the source. Exposing a heartbeat interface that emits an event every single time is just pointless overhead for everybody that’s not interested in it.

P.S. I had to search just as hard as everybody else to supply you with that snippet above. Srly, try it click on a source file or just search the source for heartbeat and track it back from there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Echoes: the new app which lets you listen to your heart at home
Echoes is a new app which uses your smartphone's inbuilt microphone to record your heart sounds. You can play the recordings of your...
Read more >
How To Hear A Heartbeat Without A Stethoscope
If you're having difficulty hearing your heartbeat, move the stethoscope slightly to the left and try to keep the room as quiet as...
Read more >
How to Hear Your Own Heartbeat Without a Stethoscope
Concentrate on listening to your heartbeat. Unless your heart is beating faster than normal it will take a few seconds to notice the...
Read more >
Tools for Listening to Your Baby's Heartbeat - Verywell Family
How to Hear to Your Baby's Heartbeat · Stethoscope · Fetal Heart Rate Monitoring Apps · Fetoscope · Pinard Horn · Fetal Doppler...
Read more >
This App Will Let You Hear Your Baby's Heartbeat at Home
"Shell – Baby's First Heartbeat Listener enables expectant parents to hear their baby's heartbeat in a natural and non-invasive manner, similar ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found