WS::frame

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 <frame-type> <payload> <mask>

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 <payload>

Prepend specified data to the frame payload. This option is not available when preserve masking is configured in the Websocket profile.

WS::frame append <payload>

Append specified data to the frame payload. This option is not available when preserve masking is configured in the Websocket profile.

WS::frame replace <payload>

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.

Syntax

WS::frame ( 'eom' | 'drop' | 'orig_masked' | 'type' | 'mask' | ('insert' FRAME_TYPE PAYLOAD (MASK)? ) |
                    ( 'prepend' PAYLOAD ) | ( 'append' PAYLOAD ) | ( 'replace' PAYLOAD ))

=

WS::frame ( ‘eom’ | ‘drop’ | ‘orig_masked’ | ‘type’ | ‘mask’ | (‘insert’ FRAME_TYPE PAYLOAD (MASK)? ) | ( ‘prepend’ PAYLOAD ) | ( ‘append’ PAYLOAD ) | ( ‘replace’ PAYLOAD ))=====

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"
 }

Change Log

@BIGIP-12.1 –First introduced the command.

The BIG-IP API Reference documentation contains community-contributed content. F5 does not monitor or control community code contributions. We make no guarantees or warranties regarding the available code, and it may contain errors, defects, bugs, inaccuracies, or security vulnerabilities. Your access to and use of any code available in the BIG-IP API reference guides is solely at your own risk.