Creating Push Requests in Control Center
You can easily evaluate, create and save push requests in Control Center.
On this page
General
Push requests allow you to send service requests to web-based clients over a Websocket endpoint. Each push request contains a service request which is triggered in the client the push request was sent to.
For more information, see Push Requests.
Using Control Center, you can evaluate and save push requests for later use.
As of now, only the Notify
service request is available for use with push requests. This service request can have different commands which provide different functionalities. All the types you can use as commands are grouped in the com.braintribe.model.uicommand
package.
Evaluating Push Requests
Evaluating a push request means sending a push request without saving it. This is especially useful when you need to send a single push request.
To evaluate a push request:
- In Control Center, use the Quick Access search box to open the
PushRequest
service request. - In the new PushRequest tab, inspect the parameters:
Parameter | Description |
---|---|
clientIdPattern | A regular expression matching the registered client IDs. The request will only be sent to those client IDs that match the expression, for example, using tribefire-control-center.auth as the value means the request will be pushed only to Control Center instances in the auth access. This is a regular expression, so you might have to escape certain characters with / . |
rolePattern | A regular expression matching the username, user role or the group derived from the registered session IDs. The request will only be sent to those that match the expression, for example using tf-locksmith as the value means the request will be pushed only to users who have the tf-locksmith role assigned, using \$user-john means the request will be pushed only to the user whose name parameter's value is john . This is a regular expression, so you might have to escape certain characters with / . For more information, see User Roles. |
serviceRequest | The service request you want to push. This parameter is mandatory. |
sessionIdPattern | A regular expression matching the registered session IDs. The request will only be sent to those sessions that match the expression. This is a regular expression, so you might have to escape certain characters with / . |
If a pattern isn't specified, all registered clients match, which means if you don't specify any of the above options, all registered clients will receive the push request.
- In this example, we want to send a notification to every user in every client connected to your tribefire instance so we leave the
clientIdPattern
,rolePattern
, andsessionIdPattern
fields empty. - In the
serviceRequest
field, click the Assign link. A search box opens. - In the search box, look for the
Notify
type, select it, and click Finish. A new window opens. - In the new window, in the notifications section, click the Add link. A search box opens.
- In the search box, select the MessageNotification type and click Add and Finish. A configuration screen of the
MessageNotification
type opens. - In the configuration screen, mark the confirmationRequired checkbox (this means the notification displayed cannot be closed without clicking a button). In the level field, select SUCCESS, and in the message field, provide the message you want to have displayed, for example: This is my first push request!. Once done, click Apply on the remaining screens until you see the PushRequest tab again.
- In the PushRequest tab (which has the serviceRequest field populated now), click Evaluate. Your push request with the attached
Notify
service request is sent and evaluated:
Saving Push Requests
You can create a push request and save it so that you can evaluate it later without having to configure it from scratch.
To create and save a push request:
- In Control Center, use the Quick Access search box to open the
PushRequest
entity type. - In the new PushRequest tab, click New, select PushRequest, and click OK. A push request configuration window appears.
- In the configuration window, inspect the parameters:
Parameter Description clientIdPattern
A regular expression matching the registered client IDs. The request will only be sent to those client IDs that match the expression, for example, using tribefire-control-center.auth
as the value means the request will be pushed only to Control Center instances in theauth
access.
This is a regular expression, so you might have to escape certain characters with/
.rolePattern
A regular expression matching the username, user role or the group derived from the registered session IDs. The request will only be sent to those that match the expression, for example using tf-locksmith
as the value means the request will be pushed only to users who have thetf-locksmith
role assigned, using\$user-john
means the request will be pushed only to the user whosename
parameter's value isjohn
.
This is a regular expression, so you might have to escape certain characters with/
.
For more information, see User Roles.serviceRequest
The service request you want to push.
This parameter is mandatory.sessionIdPattern
A regular expression matching the registered session IDs. The request will only be sent to those sessions that match the expression.
This is a regular expression, so you might have to escape certain characters with/
.
If a pattern isn't specified, all registered clients match, which means if you don't specify any of the above options, all registered clients will receive the push request. Also, you can explicitly add a
sessionId
and a list of metadata to your request when you create if using thePushRequest
type.
- In this example, we want to send a notification to every user in every client connected to your tribefire instance so we leave the
clientIdPattern
,rolePattern
,sessionId,
andsessionIdPattern
fields empty. - In the
serviceRequest
field, click the Assign link. A search box opens. - In the search box, look for the
Notify
type, select it, and click Finish. A new window opens. - In the new window, in the notifications section, click the Add link. A search box opens.
- In the search box, select the MessageWithCommand type and click Add and Finish. A configuration screen of the
MessageWithCommand
type opens. - In the configuration screen, mark the confirmationRequired checkbox (this means the notification displayed cannot be closed without clicking a button). In the command section, click the Assign link. A search box opens.
- In the search box, select the GoToUrl typs from the list and click Finish. A command configuration screen is displayed.
- In the command configuration screen, paste the
https://academy.tribefire.com/
link in the url field and click Apply. - In the level field, select INFO, and in the message field, provide the message you want to have displayed, for example: Check out our awesome tutorials!. Once done, click Apply on the remaining screens until you see the PushRequest tab again.
- In the PushRequest tab, click Commit, then right-click your push request and select Execute Service. Your push request is sent and evaluated:
When you click OK, the
https://academy.tribefire.com/
link is opened in a new tab.