Last active
August 7, 2017 20:24
-
-
Save juliangruber/fe383095909a9e237c11a5318262920b 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
const writeToRemote = new PassThrough() | |
reconnect(async con => { | |
await sendState(con) | |
writeToRemote.pipe(con) | |
}).on('disconnect', () => { | |
writeToRemote.unpipe() | |
}) | |
theRestOfYourProgram.pipe(writeToRemote) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment