ltm rule command WS frame
iRule(1) BIG-IP TMSH Manual iRule(1)
WS::frame
This command allows you to perform various operations on a Websocket
frame, determine whether this frame indicates the end of the message,
insert a new frame, drop the current frame, or manipulate the frame by
prepending, appending or replacing the contents of the frame.
SYNOPSIS
WS::frame ( 'eom' | 'drop' | 'orig_masked' | 'type' | 'mask' |
('insert' FRAME_TYPE PAYLOAD (MASK)? ) |
( 'prepend' PAYLOAD ) | ( 'append' PAYLOAD ) | (
'replace' PAYLOAD ))
DESCRIPTION
WS::frame eom
The command can be used to determine whether current frame is last
one in the Websocket message.
WS::frame orig_masked
The command can be used to determine whether current frame received
from the client or server was masked.
WS::frame type
The command can be used to determine the type of current frame
received from the client or server.
WS::frame mask
The command can be used to determine the mask of the current frame.
WS::frame drop
The command can be used to drop the current frame.
WS::frame insert
Insert a text/binary frame. The new frame will be inserted before
the current frame. Length is determined from payload. EOM is set to
TRUE by default. Mask is an optional parameter. If mask is specified,
the frame will be masked and mask bit in the header will be set.
WS::frame prepend
Prepend specified data to the frame payload. This option is not
available when preserve masking is configured in the Websocket profile.
WS::frame append
Append specified data to the frame payload. This option is not
available when preserve masking is configured in the Websocket profile.
WS::frame replace
Replace contents of the current frame payload with the specified
data. This option is not available when preserve masking is configured
in the Websocket profile.
RETURN VALUE
The eom, orig_masked, type and mask commands return the values of
corresponding fields in the Websockets frame header. Drop, insert,
prepend, append and replace can be used to manipulate the frame
contents.
VALID DURING
WS_CLIENT_FRAME WS_SERVER_FRAME
EXAMPLES
when WS_CLIENT_FRAME {
set mask [expr { int(20 * rand()) }]
log local0. "Websocket frame eom: [WS::frame eom]"
log local0. "Websocket frame received mask: [WS::frame orig_masked]"
log local0. "Websocket frame type: [WS::frame type]"
log local0. "Websocket frame mask: [WS::frame mask]"
WS::frame drop
WS::frame insert 1 "abcdefghi" $mask
WS::frame prepend "Using WS I sent "
WS::frame append "message was sent"
WS::frame replace "replaced"
}
when WS_SERVER_FRAME {
log local0. "Websocket frame eom: [WS::frame eom]"
log local0. "Websocket frame received mask: [WS::frame orig_masked]"
log local0. "Websocket frame type: [WS::frame type]"
log local0. "Websocket frame mask: [WS::frame mask]"
WS::frame drop
WS::frame insert 1 "abcdefghi"
WS::frame prepend "Using WS I sent "
WS::frame append "message was sent"
WS::frame replace "replaced"
}
HINTS
SEE ALSO
CHANGE LOG
@BIGIP-12.1.0 --First introduced the command.
BIG-IP 2017-01-31 iRule(1)