Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mirhmousavi committed May 3, 2024
1 parent 4cc5622 commit 3d95b38
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,16 @@ function loadSurfly() {
console.log("Connection has been opened");


const adminapiCobrowseRoom = drone.subscribe('adminapi-cobrowse');
adminapiCobrowseRoom.on('open', error => {
const adminAPIRoom = drone.subscribe('adminAPI');
adminAPIRoom.on('open', error => {
if (error) {
return console.error(error);
} else {
console.log("Admin API Cobrowse room has been opened");
console.log("Admin API room has been opened");
}
});

adminapiCobrowseRoom.on('message', message => {
adminAPIRoom.on('message', message => {
const nic_contact_id = message.data.nic_contact_id;
if (message.data.unique_page_id === getOrCreateUniqueClientID()) {
Surfly.on('session_created', function(session, event) {
Expand All @@ -263,20 +263,22 @@ function loadSurfly() {
"Content-Type": "application/json",
},
body: JSON.stringify({
follower_link: session.followerLink,
cluster_nic: clusterNiC,
nic_contact_id: nic_contact_id,
follower_link: session.followerLink,
pin: session.pin,
}),
}
).then(response => {
return response.json();
}).then(result => {
console.log("Success:", result);
}).catch(error => {
).catch(error => {
console.error("Error:", error);
});
});
createSurflySession(nic_contact_id, 'cobrowse', false);
if (message.data.type === 'cobrowse')
createSurflySession(nic_contact_id, 'cobrowse', false);
else if (message.data.type === 'videochat')
createSurflySession(nic_contact_id, 'videochat', false);
else:
console.error("Invalid type of session requested");
}
});

Expand Down

0 comments on commit 3d95b38

Please sign in to comment.