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 "jakarta.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.
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 jakarta. Implements jakarta.
Returns a non-null, empty, unmodifiable |
| public String | getFamily()
Implements abstract jakarta.
Returns |
| public String | Returns: The JavaScript event handler function that is invoked when the websocket is closed and will not anymore attempt to reconnect.Returns the JavaScript event handler function that is invoked when the websocket is closed and will not anymore attempt to reconnect. |
| public String | Returns: The JavaScript event handler function that is invoked when a connection error has occurred and the websocket will attempt to reconnect.Returns the JavaScript event handler function that is invoked when a connection error has occurred and the websocket will attempt to reconnect. |
| 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 and will not anymore attempt to reconnect. |
| public void | setOnerror(String
The JavaScript event handler function that is invoked when a reconnection error has occurred. onerror)Sets the JavaScript event handler function that is invoked when a connection error has occurred and the websocket will attempt to reconnect. |
| 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 jakarta.
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 jakarta. Implements jakarta.
Returns a non-null, empty, unmodifiable
| |
| getFamily | back to summary |
|---|---|
| public String getFamily() Implements abstract jakarta.
Returns
| |
| getOnclose | back to summary |
|---|---|
| public String getOnclose() Returns the JavaScript event handler function that is invoked when the websocket is closed and will not anymore attempt to reconnect.
| |
| getOnerror | back to summary |
|---|---|
| public String getOnerror() Returns the JavaScript event handler function that is invoked when a connection error has occurred and the websocket will attempt to reconnect.
| |
| 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 Jakarta Expression Language 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
and will not anymore attempt to reconnect. The function will be invoked
with three arguments: the close reason code, the channel name and the raw
| |
| setOnerror | back to summary |
|---|---|
| public void setOnerror(String onerror)
Sets the JavaScript event handler function that is invoked when a connection error has occurred and the websocket
will attempt to reconnect. The function will be invoked with three arguments: the error 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 Jakarta Expression Language 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 jakarta.
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. | |
| 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. | |
| onerror | 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. | |