jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] Re: [jsr372-experts mirror] Re: f:websocket hoisting

From: arjan tijms <arjan.tijms_at_gmail.com>
Date: Wed, 15 Feb 2017 10:45:48 +0100

Hi,

The "remaining items" Manfred mentioned were for things left open for 2.3.

For 2.3 at this moment only the most critical blocking code can still be
changed, so for this one I guess it's a matter of filing an issue against
2.4 then.

Kind regards,
Arjan Tijms




On Wed, Feb 15, 2017 at 10:27 AM, Christian Kaltepoth <
christian_at_kaltepoth.de> wrote:

> What would be the next steps for our suggestion? Should we file a JIRA
> issue for it? I think this perhaps belongs into the "remaining items"
> feedback list Manfred mentioned.
>
> 2017-02-13 19:02 GMT+01:00 Rahman USTA <rahman.usta.88_at_gmail.com>:
>
>> Hi Bauke,
>>
>> I see the following PR here https://github.com/javase
>> rverfaces/mojarra/commit/216dadaa80a9353e75781a5cfd010305e078c96d
>>
>> I also agree with Christian's suggestion.
>>
>> Thanks
>>
>> 2017-02-13 15:09 GMT+03:00 Christian Kaltepoth <christian_at_kaltepoth.de>:
>>
>>> Hey Bauke,
>>>
>>> thank you very much for your response. Actually I wasn't aware that
>>> <f:ajax> works inside <f:websocket>. That's really great and simplifies
>>> many common use cases.
>>>
>>> However, I still think that the way custom listeners (onmessage, onopen
>>> and onclose) are registered should be improved. IMO this is very important
>>> for integration with modern client side JavaScript. So it would be great to
>>> have something similar to "jsf.ajax.addOnEvent" for websockets.
>>>
>>> Christian
>>>
>>> 2017-02-12 20:02 GMT+01:00 Bauke Scholtz <balusc_at_gmail.com>:
>>>
>>>> Rahman,
>>>>
>>>> Script loading issue was an oversight during transformation of
>>>> f:websocket from TagHandler to UIComponent. I've fixed it as per
>>>> https://java.net/jira/browse/JAVASERVERFACES-4225
>>>>
>>>>
>>>> Christian,
>>>>
>>>> As to jsf.push.addOnMessage(), a very valid point there.
>>>>
>>>> In the meanwhile, you could just embed <f:ajax> in <f:websocket>.
>>>>
>>>> <f:websocket>
>>>> <f:ajax event="push" render="holder" />
>>>> </f:websocket>
>>>> <h:outputText id="holder" value="#{bean.message}" />
>>>>
>>>> No need for a custom script. Support for this was added in 2.3.0-m09.
>>>>
>>>> Cheers, Bauke
>>>>
>>>> On Sun, Feb 12, 2017 at 1:20 PM, Christian Kaltepoth <
>>>> christian_at_kaltepoth.de> wrote:
>>>>
>>>>> Hey all,
>>>>>
>>>>> I agree with Rahman that this is pretty weird behavior. But I guess
>>>>> this is more an implementation issue than a spec issue.
>>>>>
>>>>> However, I would like to note that in my view the current way to
>>>>> specify message callbacks isn't very nice. Especially because developers
>>>>> have to define callback functions in the global scope, which is considered
>>>>> as bad practice in modern JavaScript development.
>>>>>
>>>>> What about something like this:
>>>>>
>>>>>
>>>>> <f:websocket id="mySocket" channel="push" />
>>>>>
>>>>> <script type="application/javascript">
>>>>>
>>>>> // register callback using the client id
>>>>> jsf.push.addOnMessage('mySocket', function(message)) {
>>>>> // process message
>>>>> });
>>>>>
>>>>> </script>
>>>>>
>>>>>
>>>>> With this API developers won't have to define any global callback
>>>>> functions and they can even dynamically add more listeners at runtime if
>>>>> required. It is somehow similar to "jsf.ajax.addOnEvent()", but would
>>>>> always refer to a specific "<f:websocket>" using the clientId.
>>>>>
>>>>> Thoughts?
>>>>>
>>>>> Best regards
>>>>>
>>>>> Christian
>>>>>
>>>>>
>>>>>
>>>>> 2017-02-04 13:12 GMT+01:00 Rahman USTA <rahman.usta.88_at_gmail.com>:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I'm trying JSF 2.3's new WebSocket support.
>>>>>>
>>>>>> When I declare onmessage function above of <f:websocket declaration,
>>>>>> it finds referenced function. So the following usage works;
>>>>>>
>>>>>> <script type="application/javascript">
>>>>>> function onMessage(message) {
>>>>>> document.getElementById('holder').innerText = message;
>>>>>> }
>>>>>> </script>
>>>>>>
>>>>>> <f:websocket
>>>>>> channel="push"
>>>>>> onmessage="onMessage"/>
>>>>>>
>>>>>>
>>>>>> But, when I move the script declaration below the <f:websocket, it
>>>>>> doesn't find onMessage function. So the following usage doesn't work;
>>>>>>
>>>>>> <f:websocket
>>>>>> channel="push"
>>>>>> onmessage="onMessage"/>
>>>>>>
>>>>>> <script type="application/javascript">
>>>>>> function onMessage(message) {
>>>>>> document.getElementById('holder').innerText = message;
>>>>>> }
>>>>>> </script>
>>>>>>
>>>>>> I think it would be good if the last usage supported.
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> --
>>>>>> Rahman USTA
>>>>>> Istanbul JUG
>>>>>> https://github.com/rahmanusta
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Christian Kaltepoth
>>>>> Blog: http://blog.kaltepoth.de/
>>>>> Twitter: http://twitter.com/chkal
>>>>> GitHub: https://github.com/chkal
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> Christian Kaltepoth
>>> Blog: http://blog.kaltepoth.de/
>>> Twitter: http://twitter.com/chkal
>>> GitHub: https://github.com/chkal
>>>
>>>
>>
>>
>> --
>> Rahman USTA
>> Istanbul JUG
>> https://github.com/rahmanusta
>>
>
>
>
> --
> Christian Kaltepoth
> Blog: http://blog.kaltepoth.de/
> Twitter: http://twitter.com/chkal
> GitHub: https://github.com/chkal
>
>