Smartpoint Cloud Connector
Overview
The Smartpoint Cloud Connector plugin is a powerful tool designed to facilitate communication between third-party applications and Smartpoint Cloud. It acts as a bridge, allowing seamless interaction and data exchange between the two applications. It achieves this by providing a mechanism for sending and receiving messages and events bidirectionally. The plugin simplifies the process of integrating external applications with the SDK, allowing for seamless data exchange and interaction.
This technical documentation provides detailed information about the Smartpoint Cloud Connector plugin, including its features, messaging schemas, and usage guidelines.
Purpose
The primary purpose of the Smartpoint Cloud Connector plugin is to facilitate the integration of third-party applications with Smartpoint Cloud and it provides a secure and efficient way to send and receive data, trigger events, and perform actions while using the Smartpoint Cloud SDK without the need of creating your own Smartpoint Cloud plugin.
Features
Webview Integration
The Smartpoint Cloud Connector plugin seamlessly integrates third-party applications with Smartpoint Cloud through a webview. It supports various webview implementations and ensures compatibility across different platforms and devices.
Message Passing
The plugin enables bidirectional message passing between Smartpoint Cloud and third-party applications. This allows data to be exchanged efficiently, enabling real-time updates, retrieving information from the web application, and triggering actions in both directions.
Event Handling
The Smartpoint Cloud Connector plugin supports event handling, allowing third-party applications to trigger and respond to events within the web application. This facilitates interactive experiences and enables synchronization between the webview and the external application.
Exposed SDK functionality
The plugin exposes a subset of the SDK functionality:
|
Type |
Description |
|---|---|
|
Information about exposed SDK actions by the gateway plugin |
|
|
Information about exposed SDK execute commands by the gateway plugin |
|
|
Information about registering and unregistering a collection of cryptic entries or regular expressions to be intercepted |
|
|
Information about exposed SDK selectors by the gateway plugin |
|
|
Set the availability to ticket a reservation |
|
|
Information about exposed SDK XML transactions methods by the gateway plugin |
|
|
Information about exposed SDK events by the gateway plugin |
Usage
Load the webview component in your application.
Add a webview to your application and set the Smartpoint Cloud web application as the source.
WPF example:
<wpf:WebView2 Name="webView" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Source="https://smartpoint-sandbox.tvlport.com/"/>
Sending Messages
To send messages from the the third-party to Smartpoint Cloud via the Smartpoint Cloud Connector plugin, use the provided API of your WebView component.
The request schema is as follows:
{
id: GUID | string,
windowNumber: 1,
type: "action" | "selector" | "xmlTransaction" | "executeCommand",
operation: "sdkMethod" | "selectorName" | "requestSingleTransaction",
parameters: Object | string
}
C# Example:
var message = new MessageRequest
{
id = Guid.NewGuid().ToString(),
type = "action",
operation = "clearTerminal",
windowNumber = "1",
};
webView.CoreWebView2.PostWebMessageAsJson(JsonConvert.SerializeObject(message));
Receiving Messages
To receive messages from Smartpoint Cloud to your application, register event listeners or callbacks that are triggered when a message is received in your web view component.
The response schema is as follows:
{
id: GUID | string,
success: true | false,
type: "action" | "selector" | "xmlTransaction" | "executeCommand" | "event",
operation: "sdkMethod" | "selectorName" | "requestSingleTransaction" | "eventName",
result: Object | string
}
C# Example:
/// <summary>
/// Subscribe to events
/// </summary>
private void SubscribeToEvents()
{
await webView.EnsureCoreWebView2Async(null);
webView.CoreWebView2.WebMessageReceived += CoreWebView2_WebMessageReceived;
}
/// <summary>
/// Receive message from webview
/// </summary>
/// <param name="sender">The webview</param>
/// <param name="e">The web message received event</param>
private async void CoreWebView2_WebMessageReceived(object? sender, CoreWebView2WebMessageReceivedEventArgs e)
{
dynamic message = JsonConvert.DeserializeObject(e.WebMessageAsJson);
Console.WriteLine("Terminal command sent: " + message);
// Message received:
// {
// success": true
// type: "event"
// operation: "@orion/terminals-helper/RECEIVE_TERMINAL_RESPONSE"
// result: {
// ""cryptic"": ""SON/C30655""
// }
// }
}