Details
Description
I use the socket below.
<f:websocket id="usersocket" connected="false"
onmessage="userSocketListener"
onopen="userSocketOpened"
onclose="userSocketClosed"
onerror="alert('ERROR')"
/>
If I call jsf.push.open('usersocket') and __ userSocketOpened() is called.
Then I call jsf.push.close('usersocket') and userSocketClosed() is called.
Then I call jsf.push.open('usersocket') and userSocketOpened() is not called.
I looked into myfaces-api-2.3.1-sources.jar!\META-INF\internal-resources\org.apache.myfaces.core.api\jsf.js and found the onopen eventhandler in line 283:
socket.onopen = function(event) {
if (reconnectAttempts == null) {
var clientIds = clientIdsByTokens[channelToken];
for (var i = clientIds.length - 1; i >= 0; i--){
var socketClientId = clientIds[i];
components[socketClientId]['onopen'](channel);
}
}
reconnectAttempts = 0;
}
When the socket is opened the first time reconnectAttempts is null, when the socket is opened the second time reconnectAttempts is 0, so the line should be
if (reconnectAttempts == null || reconnectAttempts == 0)