zest.js
function (token, path, payload, contentFormat) {
            return new Promise((resolve,reject)=>{

                let zh = NewZestHeader();
                zh.code = 2;
                zh.token = token;
                zh.tkl = token.length;
                zh.payload = payload;
                zh.oc = 3;
                zh.options.push(NewZestOptionHeader(11,path,path.length));
                let hostname = os.hostname();
                zh.options.push(NewZestOptionHeader(3,hostname,hostname.length));
                zh.options.push(NewZestOptionHeader(12,contentFormatToInt(contentFormat),2)); //uint32

                let msg = MarshalZestHeader(zh)
                sendRequestAndAwaitResponse(this.ZMQsoc,msg)
                .then((resp)=>{
                    handleResponse(resp,(zh)=>{resolve(zh.payload)},reject);
                })
                .catch((err)=>{
                    reject(err);
                });
            });
        }
function (token, path, payload, contentFormat) {
            return new Promise((resolve,reject)=>{

                let zh = NewZestHeader();
                zh.code = 2;
                zh.token = token;
                zh.tkl = token.length;
                zh.payload = payload;
                zh.oc = 3;
                zh.options.push(NewZestOptionHeader(11,path,path.length));
                let hostname = os.hostname();
                zh.options.push(NewZestOptionHeader(3,hostname,hostname.length));
                zh.options.push(NewZestOptionHeader(12,contentFormatToInt(contentFormat),2)); //uint32

                let msg = MarshalZestHeader(zh)
                sendRequestAndAwaitResponse(this.ZMQsoc,msg)
                .then((resp)=>{
                    handleResponse(resp,(zh)=>{resolve(zh.payload)},reject);
                })
                .catch((err)=>{
                    reject(err);
                });
            });
        }
function ( token , path , payload , contentFormat ) { return new Promise ( ( resolve , reject ) => { let zh = NewZestHeader ( ) ; zh . code = 2 ; zh . token = token ; zh . tkl = token . length ; zh . payload = payload ; zh . oc = 3 ; zh . options . push ( NewZestOptionHeader ( 11 , path , path . length ) ) ; let hostname = os . hostname ( ) ; zh . options . push ( NewZestOptionHeader ( 3 , hostname , hostname . length ) ) ; zh . options . push ( NewZestOptionHeader ( 12 , contentFormatToInt ( contentFormat ) , 2 ) ) ; //uint32 let msg = MarshalZestHeader ( zh ) sendRequestAndAwaitResponse ( this . ZMQsoc , msg ) . then ( ( resp ) => { handleResponse ( resp , ( zh ) => { resolve ( zh . payload ) } , reject ) ; } ) . catch ( ( err ) => { reject ( err ) ; } ) ; } ) ; }
a dict to keep track of observers so they can be closed
a dict to keep track of observers so they can be closed