Skip to content

Instantly share code, notes, and snippets.

@juliangruber
Last active August 7, 2017 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juliangruber/fe383095909a9e237c11a5318262920b to your computer and use it in GitHub Desktop.
Save juliangruber/fe383095909a9e237c11a5318262920b to your computer and use it in GitHub Desktop.
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