Render a JavaScript function that invokes jsf.push.init()
function.
Encode Behavior
Render an HTML script
element with an "id" attribute. Render JavaScript function which invokes jsf.push.init()
function with data provided by onopen
, onmessage
, onclose
and connected
arguments, if any.
Attributes |
Name | Required | Request-time | Type | Description |
channel | false | false | java.lang.String | The name of the websocket channel. It may not be an EL expression and it may only contain alphanumeric characters, hyphens, underscores and periods. All open websockets on the same channel name will receive the same push notification from the server. |
connected | false | false | java.lang.String | Whether to (auto)connect the websocket or not. Defaults to true . It's interpreted as a JavaScript instruction whether to open or close the websocket push connection. The connected and rendered attributes are implicitly re-evaluated on every ajax request by a PreRenderViewEvent listener on the UIViewRoot . If the value of connected or rendered attribute changes to false while the websocket is already opened, then the websocket will implicitly be closed. You can also explicitly set connected attribute to false and then manually control in JavaScript by jsf.push.open(clientId) and jsf.push.close(clientId) . |
id | false | true | java.lang.String | The component identifier for this component. This value must be unique within the closest parent component that is a naming container. |
onclose | false | false | java.lang.String | The JavaScript event handler function that is invoked when the websocket is closed. The function will be invoked with three arguments: the close reason code, the channel name and the raw CloseEvent itself. Note that this will also be invoked on errors and that you can inspect the close reason code if an error occurred and which one (i.e. when the code is not 1000). See also RFC 6455 section 7.4.1 and CloseCodes API for an elaborate list of all close codes. |
onmessage | false | false | java.lang.String | The JavaScript event handler function that is invoked when a push message is received from the server. The function will be invoked with three arguments: the push message, the channel name and the raw MessageEvent itself. |
onopen | false | false | java.lang.String | The JavaScript event handler function that is invoked when the websocket is opened. The function will be invoked with one argument: the channel name. |
rendered | false | false | javax.el.ValueExpression
(must evaluate to boolean )
| Flag indicating whether or not this component should be rendered (during Render Response Phase), or processed on any subsequent form submit. The default value for this property is true. |
scope | false | false | java.lang.String | The scope of the websocket channel. It may not be an EL expression and allowed values are application , session and view , case insensitive. When the value is application , then all channels with the same name throughout the application will receive the same push message. When the value is session , then only the channels with the same name in the current user session will receive the same push message. When the value is view , then only the channel in the current view will receive the push message. The default scope is application . When the user attribute is specified, then the default scope is session . |
user | false | false | java.lang.String | The user identifier of the websocket channel, so that user-targeted push messages can be sent. It must implement Serializable and preferably have low memory footprint. Suggestion: use #{request.remoteUser} or #{someLoggedInUser.id} . All open websockets on the same channel and user will receive the same push message from the server. |
binding | false | false | javax.el.ValueExpression
(must evaluate to javax.faces.component.UIComponent )
| The ValueExpression linking this component to a property in a backing bean |