cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1337
Views
5
Helpful
8
Replies

Bosh Connection automatically closed

pravin1
Level 1
Level 1

Hi Team,

We have developed custom Cisco finesse agent desktop using rest API and using BOSH (XAMPP) to make connection with Finesse server. Everything is working fine but when logged in agent is in idle for couple of minutes BOSH connection gets closed with following error in logs.

closed: <stream:error xmlns:stream="http://etherx.jabber.org/streams"><service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-streams"/></stream:error>

Please help me to understatnd why this error comes and how we can resolve this issue.

Regards,

Pravin 

 

 

8 Replies 8

BOSH is being deprecated, so would you want to try another method?
https://developer.cisco.com/docs/finesse/#!deprecated-features

realexan
Cisco Employee
Cisco Employee

Hi Renjith,

We have used Non gadget sample for development. In this sample where and how we can use ping mechanism mentioned below.

conn.sendPacket(new Packet() {
public String toXML() {
return "<iq type='get'><ping xmlns='urn:xmpp:ping' /></iq>
}
});

Our .connect method code as below.

function _eventConnect() {
if (window.jabberwerx) {
var
//Construct JID with username and domain.
jid = _username + "@" + _domain,


//Create JabbwerWerx object.
_jwClient = new jabberwerx.Client("cisco");
console.log(_domain);
console.log(jid);
//Arguments to feed into the JabberWerx client on creation.
jwArgs = {
//Defines the BOSH path. Should match the path pattern in the proxy
//so that it knows where to forward the BOSH request to.
httpBindingURL: "/http-bind",
//Calls this function callback on successful BOSH connection by the
//JabberWerx library.
errorCallback: onClientError,
successCallback: function () {
//Get the server generated resource ID to be used for subscriptions.
_finesse.setResource(_jwClient.resourceName);
//var adlCti for event handling for CRM;
_adlCti = new ADLCTI();

}
};
jabberwerx._config.unsecureAllowed = true;
//Bind invoker function to any events that is received. Only invoke
//handler if XMPP message is in the specified structure.
_jwClient.event("messageReceived").bindWhen(
"event[xmlns='http://jabber.org/protocol/pubsub#event'] items item notification",
_eventHandler);
_jwClient.event("clientStatusChanged").bind(function (evt) {
if (evt.data.next == jabberwerx.Client.status_connected) {
/* var state = $(data).find("state");
var userState = $(data).find("data > user > state");
console.log("Agent state : " + userState);
var userState = $(data).find('state').text();
console.log("Agent state :---- " );
if (state.length > 0 && state[0].innerHTML == 'LOGOUT') { */
_finesse.sysInfo(false,
(data)=>{
var userState = $(data).find('state').text();
console.log("Agent state :---- " );
console.log("Agent state : " + userState);

console.log("sysInfo");
sysInformation = data;
console.log(data);
_finesse.sysInfo(true, _sysInfohandler, _sysInfohandler);
setTimeout(()=>{
console.log("----------------");
console.log(data);
sysInformation = data;
},30);

},
()=>{console.log("sysInfo")});
// ()=>{console.log("sysInfo")});getsignca
// _finesse.getState(_username, _getStateHandler, _agentGetStatehandler);
// attempt to login the agent

}
else if (evt.data.next == jabberwerx.Client.status_disconnected) {
console.log(evt.data.next);
// _finesse.signOut(_username, _extension, 'Sign out3', _signOutHandler, _signOutHandler);
}
});

//Connect to BOSH connection.
_jwClient.connect(jid, _password, jwArgs);
} else {
alert("CAXL library not found. Please download from http://developer.cisco.com/web/xmpp/resources")
}
}

Regards,

Pravin

 

bmachado
Cisco Employee
Cisco Employee

You must be hitting the defect - CSCvx68660. All the latest browsers throttle requests when the application is idle to optimise resources. Finesse Desktop has solved this issue in all the versions.  Please consider fixing the same in your custom client. 

-Brinal

Hi Brinal,

I would like to request you please send me the details what is fix applied in Finesse desktop to overcome from this issue or please send the code details which we need to implement.

Regards,

Pravin

 

bmachado
Cisco Employee
Cisco Employee

We have used the WebWorker thread to run in the background, which does ping-pong with the main thread responsible for doing the XMPP ping. In your case, it would be Jabberwerx, which has the default HeartBeat mechanism implemented in its implementation. You need to plug in the ping-pong from the WebWorker thread into Jabbberwerx heartbeat functionality so that even while the desktop is inactive, the WebWorker thread will ensure the client sends heartbeats w/o any throttling. 

P.S: Luckily, as of today, browsers do not throttle WebWorker interval callbacks. 

pravin1
Level 1
Level 1

Hi,

Do you have sample code or any steps to check how web worker thread code or some guidance to how we can implement in our code.

 

bmachado
Cisco Employee
Cisco Employee

Hi @pravin1 , please load the Finesse OOB desktop and look for the source (in debug console) TimedCallbackWorker.js and its invocation in openfire.js to know how we have implemented the above.
Hope that should help you out to implement the same.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: