ramonchang

Untitled

Jan 10th, 2021 (edited)
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Pusher = require("pusher-js")
  2.  
  3. const pusher = new Pusher({
  4.     appId: id,
  5.     key: key,
  6.     secret: secret,
  7.     cluster: cluster,
  8.     useTLS: true
  9.   });
  10. const channel = pusher.channel("vote-channel") // return an error that says pusher.channel is not a function
  11.  
  12. var i = 0
  13.  setInterval(() => {
  14.    if(i == 5){
  15.      i = 0
  16.      announce()
  17.    }
  18.    channel.trigger("vote-event", {
  19.      message: sampleData[i]
  20.  }).then(console.log).catch(e=> console.log(e))
  21.    i++
  22.  }, 1000 * 600);
  23.  
  24.  
  25.  
  26.  
Add Comment
Please, Sign In to add comment