If you are using Queue-it's server-side connector (KnownUser) to protect your API, you utilize this in your mobile app, to run a hybrid setup.
This greatly increases the protection and prevents visitors from bypassing the client-side Queue-it integration.
The flow in this setup is the following (simplified):
- Mobile app calls API endpoints and includes the special Queue-it header Endpoint is protected by Queue-it connector
- Queue-it connector has Trigger/Condition setup to match an Integration Action/Rule, with Queue action-type
- Queue-it connector intercepts the requests to API and immediately responds with another special Queue-it header, containing information needed to show the Waiting Room
- Mobile app shows the waiting room using the header from the Queue-it server-side connector
A sample app that shows an example of this integration can be found in the demowithprotectedapi directory.
There are a few OkHTTP interceptors in the http package that can be easily integrated.
To integrate with a protected API we need to handle the validation responses that we may get in case the user should be queued.
All calls to protected APIs need to include the x-queueit-ajaxpageurl header with a non-empty value and a Queue-it accepted cookie (if present).
The integration can be described in the following steps:
- API Request with
x-queueit-ajaxpageurlor Queue-it accepted cookie is made - We get a response which may either be the API response or an intercepted response from the Queue-it connector
- Scenario 1, user should not be queued (response does not have the
x-queueit-redirectheader)- We store the Queue-it cookies from the response, to include in later API calls
- Scenario 2, user should be queued
- If the user should be queued we'll get a
200 Okresponse with ax-queueit-redirectheader. We need to extract thec(Customer ID) ande(Waiting Room ID) query string parameters from thex-queueit-redirectheader and callQueueITEngine.runwith them, just as you would normally do with the SDK - We wait for the
onQueuePassedcallback and we store the QueueITToken passed to the callback - We can repeat the API request, this time appending the
queueittoken={QueueITToken}query string parameter, to prevent the server-side connector from intercepting the call again - We store the Queue-it cookies from the final response, so they can be set in other API calls
- If the user should be queued we'll get a
Client-side and server-side mobile integration (hybrid) with Queue-it Behind Proxy (Bring your own CDN)
Note: This only applies if you are using the Mobile SDK as a client-side protection and are using server-side protection using the Queue-it KnownUser Connector.
If you are only using client-side protection, using the Mobile SDK, refer to the documentation in the main documentation
If you are running Queue-it behind your own reverse proxy the Mobile Integration can also be setup to run behind your proxy. For the hybrid setup, your KnownUser connector will also need to run in "Behind Proxy" mode. Please contract Queue-it Support, for any questions the KnownUser Connector Behind Proxy Setup.
To do this simply use your Proxy Domain as the waitingRoomDomain parameter to QueueITEngine.run, after getting the Queue-it intercepted response back from your API.
If you are running Queue-it Waiting Room on the same domain as your normal website, you also need to provide the queuePathPrefix parameter, to ensure your proxy can route the request to Queue-it origin.
This means in ahove Implementation section, point 4.1, you must also provide waitingRoomDomain and optionally queuePathPrefix to QueueITEngine.run, to serve the Waiting Room through your reverse proxy.
