Created
November 10, 2015 23:12
-
-
Save amir-rahnama/b0a25b735f796bd69859 to your computer and use it in GitHub Desktop.
Node.js TCP Server to generate Text Streams
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
// Server creates a stream of text in EXEC_INTERVAL time period | |
var net = require('net'), | |
EXEC_INTERVAL = 1000, | |
server = net.createServer(function(socket) { | |
setInterval(function() { | |
// Make sure data ends with a new line | |
socket.write('Echo ...' + '\n'); | |
}, EXEC_INTERVAL); | |
}).listen(8000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment