onsend callback is not executed                
                
    Hi,
  
  
  
  
  
                  
                                                                                            I can't get the onsend callback working. I receive on the pbxapiadmin a response (that's the conn object var) and it should response to the original web request (req object var). See code:
conn.onmessage(function (msg) {
   log('New PbxAdminApi-Message: ' + msg);
   msg = JSON.parse(msg);
   switch (msg.mt) {
   case 'UpdateObjectResult':
   req.onsend(function (req) {
   log("in onsend");
   req.send(new TextEncoder("utf-8").encode(JSON.stringify(msg)), true);
   log("Result has been send back to client.");
   });
   req.responseContentType("json");
   log("reponse type set");
   req.sendResponse();
   log("SendResponse done");
   break;
   }
   });
In the log I do see:
08-10 14:45:41.935 booleancreator@bonkestoter.nl Data send to PBX: {"mt":"UpdateObject","api":"PbxAdminApi","src":"Johan","cn":"Johan","h323":"Johan","e164":"","node":"root","loc":"pbx","pseudo":{"type":"bool","time-map":[{"start-h":"17","start-m":"00","end-h":"23","end-m":"00","start-day":"23","start-month":"7","start-year":"2024","end-day":"24","end-month":"7","end-year":"2023"}]},"dn":"Johan"}
  08-10 14:45:41.936 booleancreator@bonkestoter.nl AppWebsocket(00227de0)::AppWebsocketMessageSend {"mt":"UpdateObject","api":"PbxAdminApi","src":"Johan","cn":"Johan","h323":"Johan","e164":"","node":"root","loc":"pbx","pseudo":{"type":"bool","time-map":[{"start-h":"17","start-m":"00","end-h":"23","end-m":"00","start-day":"23","start-month":"7","start-year":"2024","end-day":"24","end-month":"7","end-year":"2023"}]},"dn":"Johan"} connected:true
  08-10 14:45:41.937 booleancreator@bonkestoter.nl AppWebsocket(00227de0)::WebsocketSendResult() connected=1 sendCount=1
  08-10 14:45:41.937 booleancreator@bonkestoter.nl AppWebsocket(00227de0)::AppWebsocketRecvResult {"api":"PbxAdminApi","src":"Johan","mt":"UpdateObjectResult","error":"cn already exists"}
  08-10 14:45:41.938 booleancreator@bonkestoter.nl New PbxAdminApi-Message: {"api":"PbxAdminApi","src":"Johan","mt":"UpdateObjectResult","error":"cn already exists"}
  08-10 14:45:41.938 booleancreator@bonkestoter.nl reponse type set
  08-10 14:45:41.939 booleancreator@bonkestoter.nl SendResponse done
  08-10 14:45:41.939 booleancreator@bonkestoter.nl AppWebsocket(00227de0)::AppWebsocketMessageComplete connected:true
  So the case 'UpdateObjectResult':  is processed but the onsend never called.
  Any idea why?
  Richard



