Harry Ring created MYFACES-4240:
-----------------------------------

             Summary: <f:websocket /> onopen eventhandler is called only the 
first time
                 Key: MYFACES-4240
                 URL: https://issues.apache.org/jira/browse/MYFACES-4240
             Project: MyFaces Core
          Issue Type: Bug
          Components: JSR-372
    Affects Versions: 2.3.1
         Environment: java 1.8, tomcat 9.0.8, Windows 10
            Reporter: Harry Ring


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) {_
 _{color:#d04437}if (reconnectAttempts == null) {color}{_
 _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)_ 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to