diffusion
Version:
Diffusion JavaScript client
44 lines (43 loc) • 804 B
JavaScript
;
/**
* @module Protocol
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.PROTOCOL = void 0;
/**
* Protocol constants
*/
exports.PROTOCOL = {
/**
* The protocol type
*/
TYPE: 'WB',
/**
* A code indicating the clients capabilities
*/
CAPABILITIES: isZlibBundleLoaded() ? 10 : 8,
/**
* A byte inticating the diffusion protocol
*/
PROTOCOL_BYTE: 35,
/**
* The client's protocol version
*/
CURRENT_VERSION: 28
};
/**
* Check if the zlib library is installed
*
* @return `true` if the zlib module is provided
*/
function isZlibBundleLoaded() {
try {
if (require('zlib')) {
return true;
}
}
catch (err) {
return false;
}
return false;
}