Skip to content

Instantly share code, notes, and snippets.

@rhencke
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save rhencke/f14d4da5130124ef611a to your computer and use it in GitHub Desktop.

Select an option

Save rhencke/f14d4da5130124ef611a to your computer and use it in GitHub Desktop.
// maybe session.local, or maybe session.option.local. Not sure.
var binaryLocal = session.local.binary(function(value) {
// value is the newly requested value for this.
// Barring an error thrown, binaryLocal.value will equal value after the function call ends.
// Do anything needed here, like proceed if client declined, or whatever.
// can throw to decline support (forces false)
// Forces IAC WONT, regardless of if this is a request or response.
// (but tracks which it is internally.)
if (value) {
throw new Error("I can't do that, dave.");
}
}));
// Request a new value for the setting.
// Wanted to separate this from setting value below, to
// emphasize this is not a guarantee of support.
binarySrv.requestValue(true);
// currently negotiated value. Read-only.
// Can't access this unless a callback is registered.
binarySrv.value;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment