Hi Alex,
unfortunately it may not be possible out of the box. However there is one open WebSocketChannel where you can register your user and receive messages: the channel is: wss://simplifier.yourinstance.com/pushnotification/. Here is the code to open the WebSocketChannel:
var lfn_open = function(data) {
console.log( "opened", data);
};
var lfn_close = function(data) {
console.log( "closed", data);
};
var lfn_error = function(data) {
console.log("error", data);
};
var lfn_message = function(data) {
console.log("message", data);
};
var lo_ws = new WebSocket("wss://simplifier.yourinstance.com/pushnotification/");
lo_ws.onclose = lfn_close;
lo_ws.onopen = lfn_open;
lo_ws.onmessage = lfn_message;
lo_ws.onerror = lfn_error;
this.getGlobals().setVar("ws", lo_ws);
We can save the WebSocket as a global variable for further usages, the datatype must be ANY. Neat huh 😉
The next frame must be a register frame. It must be a stringified JSON Message of the following form: {“userName”: “admin”}. Please use the WebSocket to use this:
this.getGlobals().getVar("ws").send(JSON.stringify({"userName":"admin"}))
So now the problem begins. As of the moment the WebSocket Channel is not open and can only be used for Push Notifications made by a PushNotification Connector. So you have to build a Proxy which intercepts the POST Response and relays it to the PushNotification Connector, which can be accssed thorugh a Client Route. The Route is https://simplifier.yourinstance.com/client/1.0/connectorRequest
The payload must be:
{
"connectorName": "NAME OF THE PUSHNOTIFICATION CONNECTOR"
"json": {
"msg": "The String Frame"
}
}
Or you can make a call and use the following Route: https://simplifier.yourinstance.com/client/1.0/connectorCallRequest
The payload should be the following:
{
"connectorName": "NAME OF THE PUSHNOTIFICATION CONNECTOR"
"connectorCallName": "NAME OF THE PUSHNOTIFICATION CONNECTOR CALL"
"json": {
"msg": "The parameter"
}
}
or:
{
"connectorName": "NAME OF THE PUSHNOTIFICATION CONNECTOR"
"connectorCallName": "NAME OF THE PUSHNOTIFICATION CONNECTOR CALL"
"json": {
"msgAlais": "The alias"
}
}
If you manage to relay your postBody to the Message field as a Stringified JSON then the WebSocket will receive it. You could also use a PushNotification Connector and Subscribe to it, then use the same method to send the message to. The WebSocket Object however offers you more control for closing, opening, error handling and message relaying as well as managing of the registrations.
ByteFrames are not accepted unfortunately. I hope this helps, there is no direct method though. I am sorry.
Cheers
Kamil