Configure Takeover

Upon completing the session control mechanism, you can already go live without Takeover functionality. However, we recommend implementing it to enhance the user experience of your customers.

Taking over session

📘

In the client application, you should bind the takeover REST action to UI elements associated with the takeover. The actions differ and depend on the technology that you use. Hence, you should take the responsibility to bind necessary UI events, forms, buttons, etc.

If you want to know how it's to be done, refer to our sample FE application, you can also choose to use the UI elements if you prefer so.

1. In order to successfully take over the session, you need to send a POST request under the following endpoint Takeover Session. It has a similar structure as Initiate Session with the addition of one parameter in the payload: sessionId

📘

In the background, DRISC will do the following:

  • Check if provided sessions exist
  • Delete if exists. If not, return 404
  • Send the following message via Message - TAKE_OVER
  • Close Websocket Connection with the client that is being taken over.

2. Upon takeover, the client application should connect to WebSocket in the same way as it’s being handled during initiating the new session. The logic to be followed as below:

const sessionDetails = {
  sessionId: '7a05104e-3e39-4668-846b-69f40653c8bd',
  sessionName: 'Peaky Blinders S01E03',
  offerId: 'S567921766_NL'
 }
 
 const res = await fetch('https://drisc.cleeng.com/takeover', {
  method: "POST",
  headers: {
    Authorization: `Bearer ${token}`
  },
  body: JSON.stringify(sessionDetails),
});

3. When it comes to the FE perspective, the client application should display the option for the end-user to choose the session to be taken over, similar to the one below. Please refer to our FE application code for more reference.

The session name displayed here is the string that you have passed into the Initiate Session endpoint parameter sessionName

2328

Take Over Active Session

4. Upon receiving TAKE_OVER WebSocket message, the client application should also display the User Interface responsible for informing the end-user who is watching that the session was taken over. It's up to the client application to choose what message and what form of UI will be used.

You can refer to our FE application code sample for reference. We have attached the sample screenshot here,

1259

Session Taken Over