[
https://issues.apache.org/jira/browse/MYFACES-4240?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16516950#comment-16516950
]
Werner Punz edited comment on MYFACES-4240 at 6/19/18 11:21 AM:
----------------------------------------------------------------
Fixed the issue by initializing reconnectAttemtns with 0 and replacing the 0
checks with simple not checks.
It should work, but I atm do not have a proper test environment to test the fix
quickly.
Can anyone do that for me? So that I can resolve this bug.
If no one does it, it might take 1-2 days until I have the time to build a
proper testenv for that case.
was (Author: werpu):
Fixed the issue by initializing reconnectAttemtns with 0 and replacing the 0
checks with simple not checks.
It should work, but I atm do not have a proper test environment to test the fix
quickly.
Can anyone do that for me? So that I can resolve this bug.
> <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
> Assignee: Werner Punz
> Priority: Critical
>
> 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)