Conditionally send subscription events

That does seem weird, are you sure it isn’t just causing a crash and then that’s why it isn’t publishing?

As far as your goal goes, how are you determining that it is the same session? What is your plan if the same user has multiple browser tabs open? I’m not entirely sure this is a desirable optimization.