![]() |
UCefView
|
Represents a query sent from the CEF (Chromium Embedded Framework) browser to the Unreal Engine. This class encapsulates the query ID, request content, and methods for replying to the query. More...
#include <CefViewQuery.h>
Public Member Functions | |
int64 | GetId () const |
Gets the unique identifier for this query. | |
FString | GetRequest () const |
Gets the content of the query as sent from the browser. | |
void | Reply () const |
Replies to the query with the specified success status, response, and error code. | |
Public Attributes | |
bool | IsSuccess = false |
Indicates whether the query was processed successfully. | |
int32 | ErrorCode = 0 |
Error code associated with the query, if any. | |
FString | Response |
The response data for the query. | |
Protected Member Functions | |
void | SetIdAndRequest (int64 InId, const FString &InRequest) |
Sets the query ID and request content. | |
void | MarkAsReplied () const |
Marks the query as replied (for internal use only). | |
Represents a query sent from the CEF (Chromium Embedded Framework) browser to the Unreal Engine. This class encapsulates the query ID, request content, and methods for replying to the query.
UCefViewQuery
is used to handle asynchronous communication from JavaScript running in a CEF browser instance to the Unreal Engine application. Each query is uniquely identified and can be replied to with a result or error.
Queries are typically initiated from JavaScript using the CEF query API, and are received in Unreal as instances of this class. Use the provided methods and properties to inspect the query, process it, and send a response back to the browser.
Example usage in Blueprint:
int64 UCefViewQuery::GetId | ( | ) | const |
Gets the unique identifier for this query.
The query ID is assigned by the CEF framework and is used to match responses to their corresponding requests.
FString UCefViewQuery::GetRequest | ( | ) | const |
Gets the content of the query as sent from the browser.
This string contains the data or command sent from JavaScript. It is typically a JSON-encoded string or a command name.
|
protected |
Marks the query as replied (for internal use only).
This method is used internally to prevent multiple replies to the same query.
void UCefViewQuery::Reply | ( | ) | const |
Replies to the query with the specified success status, response, and error code.
Call this method after setting IsSuccess, Response, and ErrorCode to send a response back to the browser. Once replied, the query cannot be replied to again.
This method is typically called from Blueprint or C++ after processing the query.
|
protected |
Sets the query ID and request content.
InId | The query ID assigned by CEF. |
InRequest | The request content string sent from the browser. |
This method is intended for internal use to initialize the query object with data from the browser.
int32 UCefViewQuery::ErrorCode = 0 |
Error code associated with the query, if any.
Set this property to a non-zero value to indicate an error. The meaning of the error code is application-specific. If IsSuccess is true
, this value is typically ignored.
bool UCefViewQuery::IsSuccess = false |
Indicates whether the query was processed successfully.
Set this property to true
if the query was handled successfully, or false
if an error occurred. This value is sent back to the browser as part of the query response.
FString UCefViewQuery::Response |
The response data for the query.
Set this property to the string data you wish to return to the browser as the result of the query. This can be any serializable data, such as JSON or plain text.