You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.
I would like to note that in my view the current way to specify JavaScript callbacks for websocket events by referring to JavaScript functions by name 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.
Affected Versions
[2.3]
The text was updated successfully, but these errors were encountered:
I would like to note that in my view the current way to specify JavaScript callbacks for websocket events by referring to JavaScript functions by name 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:
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.
Affected Versions
[2.3]
The text was updated successfully, but these errors were encountered: