JSFiddle - React, Tailwind, and code Playground

by Abhishek Kumar

HTML

<h5>BEFORE</h5>
<li class="success">Kandy Subscription: Successfully subscribed with "https://ct-webrtc.etisalat.ae",  Response Status: 201 Response: {"subscribeResponse":{"subscriptionParams":{"notificationType":"WebSocket","expires":3600,"service":["call"],"assignedService":["RestfulClient","CallControl","CallDisplay","CallDisposition"],"localization":"English_US","notificationChannel":"/rest/version/1/user/kat1/websocket/a2F0MTQ5MTQyNDEyNTI3NTcxNjEwNDM","turnActive":true,"turnCredentials":{"username":"$$KBSAEDUB1$$2822abf3f339e79a1579039cd21e8fb810616c64","password":"jv8le0mkkfmuqr6vtfq4321s0k"}},"statusCode":0,"subscription":"/rest/version/1/user/kat1/subscription/a2F0MTQ5MTQyNDEyNTI3NTcxNjEwNDM"}}  (Elapsed Time = 532ms)</li>

<h5>AFTER</h5>
<li class="success">Kandy Subscription: Successfully subscribed with "https://ct-webrtc.etisalat.ae",  Response Status: 201 Response: {"subscribeResponse":{"subscriptionParams":{"notificationType":"WebSocket","expires":3600,"service":["call"],"assignedService":["RestfulClient","CallControl","CallDisplay","CallDisposition"],"localization":"English_US","notificationChannel":"/rest/version/1/user/kat1/websocket/a2F0MTQ5MTQyNDEyNTI3NTcxNjEwNDM","turnActive":true,"turnCredentials":{"username":"$$KBSAEDUB1$$2822abf3f339e79a1579039cd21e8fb810616c64","password":"jv8le0mkkfmuqr6vtfq4321s0k"}},"statusCode":0,"subscription":"/rest/version/1/user/kat1/subscription/a2F0MTQ5MTQyNDEyNTI3NTcxNjEwNDM"}}  (Elapsed Time = 532ms)</li>

JavaScript

url = "https://ct-webrtc.etisalat.ae";
response = {};
response.status = 201;
responseJson = {
  "subscribeResponse": {
    "subscriptionParams": {
      "notificationType": "WebSocket",
      "expires": 3600,
      "service": ["call"],
      "assignedService": ["RestfulClient", "CallControl", "CallDisplay", "CallDisposition"],
      "localization": "English_US",
      "notificationChannel": "/rest/version/1/user/kat1/websocket/a2F0MTQ5MTQyNDEyNTI3NTcxNjEwNDM",
      "turnActive": true,
      "turnCredentials": {
        "username": "$$KBSAEDUB1$$2822abf3f339e79a1579039cd21e8fb810616c64",
        "password": "jv8le0mkkfmuqr6vtfq4321s0k"
      }
    },
    "statusCode": 0,
    "subscription": "/rest/version/1/user/kat1/subscription/a2F0MTQ5MTQyNDEyNTI3NTcxNjEwNDM"
  }
};

responseObj = {
  success: 'true',
  label: 'Kandy Subscription: Successfully subscribed with "' + url + '", Response Status: ' + response.status
}

// BEFORE
responseObj.label = responseObj.label + ' Response: ' + JSON.stringify(responseJson) + '  (Elapsed Time = ' + elapsedTime + 'ms)';
responseObj.res = responseJson;

// AFTER
responseObj.label = responseObj.label + ' Response: ' + JSON.stringify(responseJson) + '  (Elapsed Time = ' + elapsedTime + 'ms)';
responseObj.res = JSON.stringify(responseJson, null, 2);