Created
October 20, 2021 10:43
-
-
Save velotiotech/94dcb281674f48033f6893571f51ac53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ws1.on('open', () => { | |
console.log('WS1 connected'); | |
let count = 0; | |
setInterval(() => { | |
const data = { | |
type: 'message', | |
message: `count is ${count}`, | |
topic: 'general' | |
} | |
const message = JSON.stringify(data); | |
ws1.send(message, (err) => { | |
if(err) { | |
console.log(`Error occurred while send data ${err.message}`) | |
} | |
console.log(`WS1 OUT ${message}`); | |
}) | |
count++; | |
}, 15000) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment