WebSocket Chilkat2 Perl Reference Documentation
Chilkat2::WebSocket
Current Version: 11.7.0
Markdown version of this page for AI tools (v 11.7.0) · all AI docs
Chilkat.WebSocket
Upgrade a connected
Send UTF-8 text or exact binary bytes as single-frame or fragmented
WebSocket messages.
Read frames, inspect opcodes and the FIN state, and accumulate fragments
until a complete message is available.
Use automatic or manual control-frame handling for keep-alive and
responsiveness checks.
Exchange Close frames, inspect the peer's status code and reason, and
terminate the underlying connection cleanly.
Share a connection between two WebSocket objects when one thread needs
to read while another writes.
For an extended overview, see
WebSocket Class Overview.
Connect to WebSocket servers and exchange client-side frames and messages.
Chilkat.WebSocket implements the client side of the WebSocket
protocol. It initiates an opening handshake with an existing WebSocket
server. It does not listen for incoming connections, accept clients, or
implement a WebSocket server.
Chilkat.WebSocket operates over an established
Chilkat.Rest connection. It creates and validates the HTTP
upgrade handshake, sends and receives text or binary frames, supports
fragmented messages, handles Ping, Pong, and Close control frames, polls for
incoming data, and exposes frame-level diagnostics.
Client opening handshake
Rest session to WebSocket and validate
the server's response before exchanging frames.
Text and binary messages
Frame-by-frame receiving
Ping and Pong
Clean close handshake
Separate read/write paths
Rest object to the server, call
UseConnection, call AddClientHeaders, send the
opening HTTP GET request through Rest, and then
call ValidateServerHandshake. Only after validation succeeds
should the application call frame send/receive methods.
ReadFrame until
FinalFrame is 1, then retrieve the accumulated data with
GetFrameData, GetFrameDataSb, or
GetFrameDataBd.
Object Creation
use Chilkat2;
my $webSocket = Chilkat2::WebSocket->new;
# or set properties (and RaiseError) at creation:
# my $webSocket = Chilkat2::WebSocket->new(VerboseLogging => 1, RaiseError => 1);Creates the object. The optional pairs set writable properties (and RaiseError) in order, as if set one by one; an unknown or read-only name croaks. use Chilkat2; loads every class; the Chilkat2/WebSocket.pm file holds only this class's documentation (perldoc Chilkat2::WebSocket).
Perl frees the object when its last reference goes (undef $webSocket, or the variable going out of scope); there is nothing to close. Objects returned by methods are independent and freed the same way. The class may be subclassed (use parent -norequire, 'Chilkat2::WebSocket';): an object is a blessed hash reference whose hash is free for the subclass's own fields.
When false (the default), a method that fails returns false (or undef), and the reason is in LastErrorText. When true, it dies with a Chilkat2::Error instead, as DBI does with its RaiseError. Objects returned by a method inherit the value of the object that returned them.
Errors
A Chilkat2::Error stringifies to the failed call's full LastErrorText, and has the methods text, class ('Chilkat2::WebSocket'), method (the method name) and object. Methods that look something up and find nothing return undef without dying (each such method says so), methods that answer a question (HasMember, IsUnlocked, ...) return a plain boolean, and property reads and writes never fail for Chilkat reasons.
Misuse always croaks, with your file and line, whatever RaiseError is: a wrong number of arguments, a reference or undef where a string or number is expected, an object of the wrong class, an out-of-range integer, a string containing a NUL character, a wide character in a byte string, or a write to a read-only property.
Strings are Perl character strings in both directions (length, regexes and :encoding layers see characters); binary data (BinData) is a byte string. Unlocking: call Chilkat2::Global->new->UnlockBundle('...') once at startup.
Properties
CloseAutoRespond
my $boolVal = $webSocket->CloseAutoRespond;
$webSocket->CloseAutoRespond($boolVal);
Controls whether Chilkat automatically answers an incoming Close control frame.
- When
1, an incoming Close is answered automatically if the client did not already initiate the close. After a Close has been both received and sent, Chilkat closes the underlying connection. - When
0, the application can detect the received Close throughCloseReceivedorFrameOpcodeand callSendCloseitself.
The default is 1.
CloseReason
my $strVal = $webSocket->CloseReason;
Returns the UTF-8 reason text contained in the received Close control frame.
The value is empty when the peer supplied no reason or when no Close frame has been received. A reason is diagnostic text and should not be treated as a stable machine-readable error identifier; use CloseStatusCode for protocol-level handling.
CloseReceived
my $boolVal = $webSocket->CloseReceived;
1 after a Close control frame has been received on the current WebSocket connection.
When CloseAutoRespond is 0, use this property to determine whether the application needs to call SendClose to complete the closing handshake. The received status code and reason, if present, are available through CloseStatusCode and CloseReason.
CloseStatusCode
my $intVal = $webSocket->CloseStatusCode;
Returns the status code contained in the received Close control frame.
Returns 0 when no Close frame has been received or when the received Close frame did not include a status code.
0 is an API sentinel; it is not a WebSocket close status transmitted by the peer.
DebugLogFilePath
my $strVal = $webSocket->DebugLogFilePath;
$webSocket->DebugLogFilePath($strVal);
If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. This logging helps identify the context and history of Chilkat calls leading up to any crash or hang, aiding in debugging.
Enabling the VerboseLogging property provides more detailed information. This property is mainly used for debugging rare instances where a Chilkat method call causes a hang or crash, which should generally not happen.
Possible causes of hangs include:
- A timeout property set to 0, indicating an infinite timeout.
- A hang occurring within an event callback in the application code.
- An internal bug in the Chilkat code causing the hang.
FinalFrame
my $boolVal = $webSocket->FinalFrame;
1 if the frame most recently delivered by ReadFrame had its WebSocket FIN bit set; otherwise 0.
For a fragmented data message, continue reading while this property is 0. The fragment with 1 completes the message. Unfragmented messages have 1 on their only frame.
FIN bit is always set.
FrameDataLen
my $intVal = $webSocket->FrameDataLen;
Returns the number of payload bytes currently accumulated in the internal receive buffer.
The value can represent data from one frame or from multiple calls to ReadFrame, which is useful when receiving a fragmented message. The accumulated bytes remain available until retrieved by GetFrameData, GetFrameDataSb, or GetFrameDataBd.
FinalFrame to determine whether the last received fragment completed the message.
FrameOpcode
my $strVal = $webSocket->FrameOpcode;
Returns the symbolic opcode of the frame most recently delivered by ReadFrame.
| Value | Meaning |
|---|---|
Continuation | A later fragment of a Text or Binary message |
Text | UTF-8 text data |
Binary | Binary data |
Close | Closing handshake |
Ping | Ping control frame |
Pong | Pong control frame |
Before any frame has been received, the value is the empty string. Ping or Pong frames handled internally by the auto-response/auto-consume options may not be returned as the current frame.
topFrameOpcodeInt
my $intVal = $webSocket->FrameOpcodeInt;
Returns the numeric opcode of the frame most recently delivered by ReadFrame.
| Value | Frame type |
|---|---|
0 | Continuation |
1 | Text |
2 | Binary |
8 | Close |
9 | Ping |
10 | Pong |
Use FrameOpcode when a readable symbolic value is preferred.
HeartbeatMs
my $intVal = $webSocket->HeartbeatMs;
$webSocket->HeartbeatMs($intVal);
Specifies the interval, in milliseconds, between AbortCheck event callbacks during supported blocking operations.
The default is 0, which disables periodic AbortCheck callbacks. Set a positive value when the application needs an opportunity to cancel a long-running send or receive operation.
SendPing and Ping/Pong handling for protocol-level heartbeat behavior.
IdleTimeoutMs
my $intVal = $webSocket->IdleTimeoutMs;
$webSocket->IdleTimeoutMs($intVal);
Specifies the maximum number of milliseconds an active send or receive operation may remain stalled while waiting for additional network progress.
The default is 30000 milliseconds (30 seconds). This is an inactivity timeout, not a total limit on the duration of the operation. An operation may continue longer than this value as long as data continues to be transferred.
SendPing when the application needs protocol-level keep-alive or responsiveness checks.
IsConnected
my $boolVal = $webSocket->IsConnected;
1 when the underlying WebSocket network connection is currently open; otherwise 0.
LastErrorHtml
my $strVal = $webSocket->LastErrorHtml;
Provides HTML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.
topLastErrorText
my $strVal = $webSocket->LastErrorText;
Provides plain text information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.
LastErrorXml
my $strVal = $webSocket->LastErrorXml;
Provides XML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.
topLastMethodSuccess
my $boolVal = $webSocket->LastMethodSuccess;
$webSocket->LastMethodSuccess($boolVal);
Indicates the success or failure of the most recent method call: 1 means success, 0 means failure. This property remains unchanged by property setters or getters. This method is present to address challenges in checking for null or Nothing returns in certain programming languages. Note: This property does not apply to methods that return integer values or to boolean-returning methods where the boolean does not indicate success or failure.
NeedSendPong
my $boolVal = $webSocket->NeedSendPong;
1 when a Ping frame has been received but no corresponding Pong has yet been sent.
This property is primarily useful when PingAutoRespond is 0. Call SendPong as soon as practical; it automatically sends the received Ping payload in the Pong response.
PingAutoRespond
my $boolVal = $webSocket->PingAutoRespond;
$webSocket->PingAutoRespond($boolVal);
Controls automatic handling of incoming Ping control frames.
- When
1, Chilkat sends the required Pong automatically andReadFrameconsumes the Ping internally, continuing until another frame is available. - When
0, the Ping can be returned to the application. CheckNeedSendPongand callSendPongas soon as practical.
The default is 1.
SendPong automatically uses the stored payload of the unanswered Ping.
PongAutoConsume
my $boolVal = $webSocket->PongAutoConsume;
$webSocket->PongAutoConsume($boolVal);
Controls whether incoming Pong control frames are hidden from the application.
- When
1,ReadFrameconsumes Pong frames internally and continues reading until a non-Pong frame is available. - When
0, an incoming Pong can be returned normally withFrameOpcodeequal toPong.
The default is 1. Check PongConsumed after ReadFrame to learn whether one or more Pong frames were consumed during that call.
PongConsumed
my $boolVal = $webSocket->PongConsumed;
1 if the most recent call to ReadFrame internally consumed a Pong frame while PongAutoConsume was 1.
The property is reset to 0 at the beginning of each ReadFrame call and set to 1 if a Pong is consumed during that call.
ReadFrameFailReason
my $intVal = $webSocket->ReadFrameFailReason;
When ReadFrame returns 0, this property categorizes the reason:
| Value | Meaning |
|---|---|
0 | No failure is recorded |
1 | Read inactivity timeout |
2 | Aborted by an application callback |
3 | Fatal socket error or lost connection |
4 | Invalid WebSocket frame bytes were received |
99 | Unexpected catch-all failure |
Use this value for programmatic branching and inspect LastErrorText for detailed diagnostics.
UncommonOptions
my $strVal = $webSocket->UncommonOptions;
Contains a comma-separated list of rarely needed compatibility or platform options. The default is the empty string and should normally remain unchanged.
| Keyword | Effect |
|---|---|
ProtectFromVpn | On Android, attempts to route the connection outside an installed or active VPN. Introduced in v9.5.0.80. |
VerboseLogging
my $boolVal = $webSocket->VerboseLogging;
$webSocket->VerboseLogging($boolVal);
If set to 1, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is 0. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.
Version
my $strVal = $webSocket->Version;
Methods
AddClientHeaders
my $success = $webSocket->AddClientHeaders();
Adds the standard client opening-handshake headers to the Rest object supplied to UseConnection:
Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: ... Sec-WebSocket-Version: 13
Sec-WebSocket-Key contains a newly generated client nonce used by the server to produce Sec-WebSocket-Accept.
Origin, Authorization, cookies, or Sec-WebSocket-Protocol, add them through the associated Rest object before sending the HTTP upgrade request.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
CloseConnection
my $success = $webSocket->CloseConnection();
Immediately closes the underlying network connection without completing the WebSocket closing handshake.
Use this method when the connection must be abandoned because of a fatal error, timeout, application shutdown, or an unresponsive peer.
SendClose, receive the peer's Close frame with ReadFrame, and allow the closing handshake to complete. An abrupt transport close does not provide the peer with a WebSocket status code or reason.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
GetFrameData
my $str = $webSocket->GetFrameData();
Returns the bytes accumulated by successful calls to ReadFrame as a string, then clears the internal receive buffer.
This method is intended for WebSocket text-message data. For arbitrary binary payloads, use GetFrameDataBd to avoid interpreting binary bytes as text.
ReadFrame until FinalFrame is 1, and then call GetFrameData once. Calling this method earlier returns and clears only the data accumulated so far.
Returns undef on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
GetFrameDataBd
# $success is true or false
my $success = $webSocket->GetFrameDataBd($binData);
Appends the bytes accumulated by successful calls to ReadFrame to binData, then clears the internal receive buffer.
Use this method for binary messages or whenever the exact received bytes must be preserved. Existing data in the destination BinData is retained because the received bytes are appended.
GetFrameData, GetFrameDataSb, or GetFrameDataBd consumes the same internal buffer. Retrieve the data using only the form needed by the application.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
GetFrameDataSb
# $success is true or false
my $success = $webSocket->GetFrameDataSb($sb);
Appends the text represented by the bytes accumulated by successful calls to ReadFrame to sb, then clears the internal receive buffer.
Existing text in the destination StringBuilder is retained. This method is most appropriate for text-message data; use GetFrameDataBd for arbitrary binary payloads.
FinalFrame is 1 before calling this method when the application wants the complete message.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
PollDataAvailable
my $flag = $webSocket->PollDataAvailable();
Checks whether bytes are currently waiting to be read from the underlying WebSocket connection.
Returns 1 when incoming data is available and 0 when no data is presently waiting.
1 result does not mean that an entire WebSocket frame or message has arrived. Call ReadFrame to parse the protocol frame. A 0 result does not indicate that the peer will not send data later.
Never dies: false is an answer, not a failure.
topReadFrame
my $success = $webSocket->ReadFrame();
Reads the next WebSocket frame from the connected server. On success, the method updates FrameOpcode, FrameOpcodeInt, FinalFrame, and FrameDataLen.
Frame payload bytes are added to an internal receive buffer. The buffer may therefore contain data accumulated by multiple calls to ReadFrame. Retrieve and clear it with GetFrameData, GetFrameDataSb, or GetFrameDataBd.
Call ReadFrame until FinalFrame is 1, then retrieve the accumulated message data. A fragmented message begins with a Text or Binary frame and continues with one or more Continuation frames.
PingAutoRespond and PongAutoConsume, incoming Ping and Pong frames may be handled internally, causing this method to continue reading until another frame is available. If the method returns 0, inspect ReadFrameFailReason and LastErrorText.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
SendClose
# $statusCode is an integer
# $reason is a string
# $success is true or false
my $success = $webSocket->SendClose($includeStatus, $statusCode, $reason);
Sends a WebSocket Close control frame and begins or completes the closing handshake.
- If
includeStatusis0, the Close frame contains no status code andstatusCodeandreasonare ignored. - If
includeStatusis1, the frame containsstatusCodefollowed by the UTF-8 bytes ofreason.
The complete Close payload cannot exceed 125 bytes, leaving at most 123 bytes for the UTF-8 reason after the two-byte status code. Chilkat truncates an overlong reason. The API accepts status-code integers from 0 through 16383.
1000 for normal closure, or an appropriate application code in the 3000–4999 range. Codes 1005, 1006, and 1015 are reserved reporting values and must not be sent in a Close frame.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
SendFrame
# $finalFrame is a boolean
# $success is true or false
my $success = $webSocket->SendFrame($stringToSend, $finalFrame);
Sends one WebSocket text data frame containing stringToSend. WebSocket text data is UTF-8 on the wire.
- Set
finalFrameto1when this frame completes the message. - Set
finalFrameto0when additional frames will follow as part of the same fragmented message.
For a normal unfragmented text message, call this method once with finalFrame set to 1. For a fragmented message, call it repeatedly and set 1 only for the final fragment.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
SendFrameBd
# $finalFrame is a boolean
# $success is true or false
my $success = $webSocket->SendFrameBd($bdToSend, $finalFrame);
Sends one WebSocket binary data frame containing the current bytes in bdToSend.
- Set
finalFrameto1when this frame completes the binary message. - Set
finalFrameto0when additional binary-message fragments will follow.
For an ordinary single-frame binary message, set finalFrame to 1.
bdToSend become the frame payload, while Chilkat applies the client-side WebSocket framing and masking required by the protocol.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
SendFrameSb
# $finalFrame is a boolean
# $success is true or false
my $success = $webSocket->SendFrameSb($sbToSend, $finalFrame);
Sends one WebSocket text data frame containing the current contents of sbToSend.
- Set
finalFrameto1when this frame completes the message. - Set
finalFrameto0when more fragments will follow.
For an ordinary single-frame text message, set finalFrame to 1. WebSocket text data is UTF-8 on the wire.
finalFrame set to 0 create fragments of the same text message. Complete the message with a final call that passes 1.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
SendPing
# $success is true or false
my $success = $webSocket->SendPing($pingData);
Sends a WebSocket Ping control frame. If pingData is non-empty, its UTF-8 bytes are included as the Ping payload.
WebSocket control-frame payloads are limited to 125 bytes. If the UTF-8 representation exceeds this limit, Chilkat truncates it to 125 bytes.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
SendPong
my $success = $webSocket->SendPong();
Sends a WebSocket Pong control frame.
When a Ping has been received and has not yet been answered, this method automatically uses the previously received Ping payload as the Pong payload, as required for a Ping response.
PingAutoRespond is 0 and NeedSendPong is 1. When automatic Ping handling is enabled, Chilkat sends the Pong internally.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
ShareConnection
# $success is true or false
my $success = $webSocket->ShareConnection($ws);
Causes the calling WebSocket object to share the already-established WebSocket connection owned by ws.
This enables a bidirectional design in which separate WebSocket objects operate on the same connection—for example, one thread blocks in ReadFrame while another thread sends frames.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
UseConnection
# $success is true or false
my $success = $webSocket->UseConnection($connection);
Associates this WebSocket object with an existing, connected Rest object and prepares it for a client-side WebSocket session.
The opening WebSocket handshake is an HTTP GET upgrade request. Using Rest for the underlying connection allows the application to configure TLS, proxies, authentication, custom request headers, IPv6, socket options, bandwidth limits, and other connection features before the upgrade is performed.
- Connect the
Restobject to the server. - Call
UseConnection. - Call
AddClientHeaders. - Send the HTTP
GETrequest with theRestobject. - Call
ValidateServerHandshake.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
ValidateServerHandshake
my $success = $webSocket->ValidateServerHandshake();
Validates the server's response to the WebSocket opening handshake sent through the associated Rest object.
Validation checks that the server accepted the HTTP upgrade and returned the expected WebSocket handshake response, including the value derived from the client's Sec-WebSocket-Key. If this method returns 1, the connection has entered the WebSocket protocol and data or control frames may be exchanged.
Rest object has sent the opening GET request and received the server's response. A successful HTTP request alone does not establish a WebSocket session; the response must also pass this validation.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
Events
All Chilkat methods are synchronous: the call returns when the work is done. During a long-running call, Chilkat2::WebSocket reports progress to handlers installed with on, which takes Event => CODE pairs (closures, so a handler can use the variables around it):
$webSocket->on(
PercentDone => sub { my ($pctDone) = @_; print "$pctDone%\n"; return 0 }, # a true return aborts
ProgressInfo => sub { my ($name, $value) = @_; print "$name: $value\n" },
);
$webSocket->HeartbeatMs(250); # the AbortCheck handler is called 4 times per secondInstalls the handlers given, replacing those installed before for the same events; undef instead of a CODE reference removes one, and $webSocket->on() with no arguments returns the installed handlers as a list of pairs. The event names are checked: a misspelled one croaks, and nothing is installed.
The AbortCheck handler is called at the interval set by the HeartbeatMs property (0, the default, disables it); PercentDone is called when an operation's completion percentage is known; ProgressInfo delivers named progress values. A true return from the AbortCheck or PercentDone handler aborts the running method, which then fails in the usual way (false or undef, or a Chilkat2::Error under RaiseError).
Handlers run during the method call, on the thread that called it. Inside a handler, other objects may be used, but calling a method of the same object (or its on) croaks. A die in a handler aborts the running method and is re-thrown from the method call; the object remains usable. A handler that uses $webSocket itself makes a reference cycle: weaken the captured copy (Scalar::Util) or remove the handler when done.
AbortCheck
$webSocket->on(AbortCheck => sub { ... });
Enables a method call to be aborted by triggering the AbortCheck event at intervals defined by the HeartbeatMs property. If HeartbeatMs is set to its default value of 0, no events will occur. For instance, set HeartbeatMs to 200 to trigger 5 AbortCheck events per second.
Example
my $deadline = time() + 30; # give up after 30 seconds
$webSocket->HeartbeatMs(250); # call the handler 4 times per second
$webSocket->on(AbortCheck => sub { return time() > $deadline });PercentDone
$webSocket->on(PercentDone => sub { ... });
This provides the percentage completion for any method involving network communications or time-consuming processing, assuming the progress can be measured as a percentage. This event is triggered only when it's possible and logical to express the operation's progress as a percentage. The pctDone argument will range from 1 to 100. For methods that finish quickly, the number of PercentDone callbacks may vary, but the final callback will have pctDone equal to 100. For longer operations, callbacks will not exceed one per percentage point (e.g., 1, 2, 3, ..., 98, 99, 100).
The PercentDone callback also acts as an AbortCheck event. For fast methods where PercentDone fires, an AbortCheck event may not trigger since the PercentDone callback already provides an opportunity to abort. For longer operations, where time between PercentDone callbacks is extended, AbortCheck callbacks enable more responsive operation termination.
To abort the operation, set the abort output argument to 1. This will cause the method to terminate and return a failure status or corresponding failure value.
Example
$webSocket->on(PercentDone => sub {
my ($pctDone) = @_; # 0 to 100
print "Percent done: $pctDone\n";
return 0; # return a true value to abort the method in progress
});ProgressInfo
$webSocket->on(ProgressInfo => sub { ... });
This event callback provides tag name/value pairs that detail what occurs during a method call. To discover existing tag names, create code to handle the event, emit the pairs, and review them. Most tag names are self-explanatory.
Note: Some Chilkat methods don't fire any ProgressInfo events.
Example
$webSocket->on(ProgressInfo => sub {
my ($name, $value) = @_;
print "$name: $value\n";
});