This file contains hidden or 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
| puts "hello" |
This file contains hidden or 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
| function subscribeToTimer(interval, cb) { | |
| } | |
| export { | |
| subscribeToTimer, | |
| }; |
This file contains hidden or 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
| function hello() { | |
| console.log('does this embed correctly in medium?'); | |
| } |
This file contains hidden or 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
| function subscribeToTimer(interval, cb) { | |
| } | |
| export { | |
| subscribeToTimer, | |
| }; |
This file contains hidden or 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
| function subscribeToTimer(interval, cb) { | |
| } | |
| export { | |
| subscribeToTimer, | |
| }; |
This file contains hidden or 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
| function subscribeToTimer(interval, cb) { | |
| } | |
| export { | |
| subscribeToTimer, | |
| }; |
This file contains hidden or 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
| const io = require('socket.io')(); | |
| io.on('connection', (client) => { | |
| client.on('subscribeToTimer', (interval) => { | |
| console.log('client is subscribing to timer with interval ', interval); | |
| setInterval(() => { | |
| client.emit('timer', new Date()); | |
| }, interval); | |
| }); | |
| }); |
This file contains hidden or 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
| io.on('connection', (client) => { | |
| client.on('subscribeToTimer', (interval) => { | |
| console.log('client is subscribing to timer with interval ', interval); | |
| setInterval(() => { | |
| client.emit('timer', new Date()); | |
| }, interval); | |
| }); | |
| }); |
This file contains hidden or 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
| io.on('connection', (client) => { | |
| client.on('subscribeToTimer', (interval) => { | |
| console.log('client is subscribing to timer with interval ', interval); | |
| }); | |
| }); |
This file contains hidden or 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
| const port = 8000; | |
| io.listen(port); | |
| console.log('listening on port ', port); |