Skip to content

Instantly share code, notes, and snippets.

@jamigibbs jamigibbs/websocketChat.js
Last active Mar 31, 2020

Embed
What would you like to do?
Enter and leave chat
handleEnterChat() {
setUserChatActive()
.then((res) => {
this.isChatActive = res.Chat_Active__c;
this._socket.emit('userEnteredChat');
return refreshApex(this.wiredChatUsers);
})
.catch(error => {
// eslint-disable-next-line no-console
console.error('handleEnterChat error', error);
this.error = 'Error updating user record';
});
}
handleLeaveChat() {
setUserChatInactive()
.then((res) => {
this.isChatActive = res.Chat_Active__c;
this._socket.emit('userLeftChat');
return refreshApex(this.wiredChatUsers);
})
.catch(error => {
// eslint-disable-next-line no-console
console.error('handleLeaveChat error', error);
this.error = 'Error updating user record';
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.