0

I have used action cable in Rails 5. I want to broadcast message to server after wait of n seconds. I made R&D for same but not find anything useful. can someone please advise me on how to broadcast message to client after waiting n period of time?

darshi kothari
  • 642
  • 1
  • 5
  • 12

1 Answers1

0

It's as simple as:

setTimeout(function () {
   App.message.speak(value);
},500); //500ms

Just out of curiosity, ActionCable is slow as is (I recommend AnyCable), why would you want to fabricate even further delay..?

Crashtor
  • 1,249
  • 1
  • 13
  • 21
  • I want to send notification to n users with accept & reject option and i will wait n seconds before sending notification response back to client and solution you provided is implement at js side but my app is api only so it's not useful – darshi kothari Aug 18 '17 at 12:39
  • Impossible to know considering you've not provided a single line of code to go with your question. Please update your question outlining your loop in detail so that you avoid wasting anyone's time. – Crashtor Aug 18 '17 at 13:07