The <f:websocket> tag opens an one-way (server to client) websocket based push connection in client
side which can be reached from server side via PushContext interface injected in any CDI/container managed
artifact via @Push annotation.
By default, the rendererType property must be set to "javax.faces.Websocket".
This value can be changed by calling the setRendererType() method.
For detailed usage instructions, see @Push javadoc.
Push
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static enum | UIWebsocket.PropertyKeys
Properties that are tracked by state saving. |
| Modifier and Type | Field and Description |
|---|---|
| public static final String | COMPONENT_FAMILY
The standard component family for this component. |
| public static final String | COMPONENT_TYPE
The standard component type for this component. |
| private static final Collection | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final Pattern |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public String | |
| public Collection | getEventNames()
Overrides javax. Implements javax.
Returns a non-null, empty, unmodifiable |
| public String | getFamily()
Implements abstract javax.
Returns |
| public String | Returns: The JavaScript event handler function that is invoked when the websocket is closed.Returns the JavaScript event handler function that is invoked when the websocket is closed. |
| public String | Returns: The JavaScript event handler function that is invoked when a push message is received from the server.Returns the JavaScript event handler function that is invoked when a push message is received from the server. |
| public String | Returns: The JavaScript event handler function that is invoked when the websocket is opened.Returns the JavaScript event handler function that is invoked when the websocket is opened. |
| public String | |
| public Serializable | Returns: The user identifier of the websocket channel.Returns the user identifier of the websocket channel. |
| public boolean | Returns: Whether to (auto)connect the websocket or not.Returns whether to (auto)connect the websocket or not. |
| public void | |
| public void | setConnected(boolean
Whether to (auto)connect the websocket or not. connected)Sets whether to (auto)connect the websocket or not. |
| public void | setOnclose(String
The JavaScript event handler function that is invoked when the websocket is closed. onclose)Sets the JavaScript event handler function that is invoked when the websocket is closed. |
| public void | setOnmessage(String
The JavaScript event handler function that is invoked when a push message is received from the server. onmessage)Sets the JavaScript event handler function that is invoked when a push message is received from the server. |
| public void | |
| public void | |
| public void | setUser(Serializable
The user identifier of the websocket channel. user)Sets the user identifier of the websocket channel, so that user-targeted push messages can be sent. |
| public void | setValueExpression(String
Name of the attribute or property for which to set a
name, ValueExpression binding)ValueExpressionOverrides javax.
Set the |
| COMPONENT_FAMILY | back to summary |
|---|---|
| public static final String COMPONENT_FAMILY The standard component family for this component. | |
| COMPONENT_TYPE | back to summary |
|---|---|
| public static final String COMPONENT_TYPE The standard component type for this component. | |
| CONTAINS_EVERYTHING | back to summary |
|---|---|
| private static final Collection<String> CONTAINS_EVERYTHING | |
| ERROR_ENDPOINT_NOT_ENABLED | back to summary |
|---|---|
| private static final String ERROR_ENDPOINT_NOT_ENABLED | |
| ERROR_INVALID_CHANNEL | back to summary |
|---|---|
| private static final String ERROR_INVALID_CHANNEL | |
| ERROR_INVALID_USER | back to summary |
|---|---|
| private static final String ERROR_INVALID_USER | |
| PATTERN_CHANNEL_NAME | back to summary |
|---|---|
| private static final Pattern PATTERN_CHANNEL_NAME | |
| UIWebsocket | back to summary |
|---|---|
| public UIWebsocket()
Create a new
| |
| getChannel | back to summary |
|---|---|
| public String getChannel() Returns the name of the websocket channel.
| |
| getEventNames | back to summary |
|---|---|
| public Collection Overrides javax. Implements javax.
Returns a non-null, empty, unmodifiable
| |
| getFamily | back to summary |
|---|---|
| public String getFamily() Implements abstract javax.
Returns
| |
| getOnclose | back to summary |
|---|---|
| public String getOnclose() Returns the JavaScript event handler function that is invoked when the websocket is closed.
| |
| getOnmessage | back to summary |
|---|---|
| public String getOnmessage() Returns the JavaScript event handler function that is invoked when a push message is received from the server.
| |
| getOnopen | back to summary |
|---|---|
| public String getOnopen() Returns the JavaScript event handler function that is invoked when the websocket is opened.
| |
| getScope | back to summary |
|---|---|
| public String getScope() Returns the scope of the websocket channel.
| |
| getUser | back to summary |
|---|---|
| public Serializable getUser() Returns the user identifier of the websocket channel.
| |
| isConnected | back to summary |
|---|---|
| public boolean isConnected() Returns whether to (auto)connect the websocket or not.
| |
| setChannel | back to summary |
|---|---|
| public void setChannel(String channel) Sets 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 will receive the same push message from the server.
| |
| setConnected | back to summary |
|---|---|
| public void setConnected(boolean connected) Sets whether to (auto)connect the websocket or not. Defaults to
| |
| setOnclose | back to summary |
|---|---|
| public void setOnclose(String onclose) Sets 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
| |
| setOnmessage | back to summary |
|---|---|
| public void setOnmessage(String onmessage) Sets 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.
| |
| setOnopen | back to summary |
|---|---|
| public void setOnopen(String onopen) Sets the JavaScript event handler function that is invoked when the websocket is opened. The function will be invoked with one argument: the channel name.
| |
| setScope | back to summary |
|---|---|
| public void setScope(String scope) Sets the scope of the websocket channel.
It may not be an EL expression and allowed values are
| |
| setUser | back to summary |
|---|---|
| public void setUser(Serializable user) Sets the user identifier of the websocket channel, so that user-targeted push messages can be sent.
All open websockets on the same channel and user will receive the same push message from the server.
It must implement
| |
| setValueExpression | back to summary |
|---|---|
| public void setValueExpression(String name, ValueExpression binding) Overrides javax.
Set the
| |
Properties that are tracked by state saving.
| Modifier and Type | Field and Description |
|---|---|
| public static final UIWebsocket. | |
| public static final UIWebsocket. | |
| public static final UIWebsocket. | |
| public static final UIWebsocket. | |
| public static final UIWebsocket. | |
| public static final UIWebsocket. | |
| public static final UIWebsocket. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static UIWebsocket. | |
| public static UIWebsocket. |
| channel | back to summary |
|---|---|
| public static final UIWebsocket. | |
| connected | back to summary |
|---|---|
| public static final UIWebsocket. | |
| onclose | back to summary |
|---|---|
| public static final UIWebsocket. | |
| onmessage | back to summary |
|---|---|
| public static final UIWebsocket. | |
| onopen | back to summary |
|---|---|
| public static final UIWebsocket. | |
| scope | back to summary |
|---|---|
| public static final UIWebsocket. | |
| user | back to summary |
|---|---|
| public static final UIWebsocket. | |
| PropertyKeys | back to summary |
|---|---|
| private PropertyKeys() | |
| valueOf | back to summary |
|---|---|
| public static UIWebsocket. | |
| values | back to summary |
|---|---|
| public static UIWebsocket. | |