|
|
@ -33,7 +33,8 @@ function app(socket) {
|
|
|
|
sendTypingEvent: function () {
|
|
|
|
sendTypingEvent: function () {
|
|
|
|
if (this.socket && this.socket.readyState === WebSocket.OPEN) {
|
|
|
|
if (this.socket && this.socket.readyState === WebSocket.OPEN) {
|
|
|
|
clearTimeout(this.typingTimeout);
|
|
|
|
clearTimeout(this.typingTimeout);
|
|
|
|
const data = { event_type: 'typing' };
|
|
|
|
const userId = document.getElementById('userId').textContent.trim();
|
|
|
|
|
|
|
|
const data = { event_type: 'typing', user_id: userId};
|
|
|
|
this.socket.send(JSON.stringify(data));
|
|
|
|
this.socket.send(JSON.stringify(data));
|
|
|
|
|
|
|
|
|
|
|
|
this.typingTimeout = setTimeout(() => {
|
|
|
|
this.typingTimeout = setTimeout(() => {
|
|
|
@ -63,7 +64,8 @@ function app(socket) {
|
|
|
|
|
|
|
|
|
|
|
|
function initializeWebSocket() {
|
|
|
|
function initializeWebSocket() {
|
|
|
|
const ticketId = document.getElementById('ticketId').textContent.trim();
|
|
|
|
const ticketId = document.getElementById('ticketId').textContent.trim();
|
|
|
|
const wsUrl = `wss://${window.location.host}/ws/ticketroom/${ticketId}/`;
|
|
|
|
const wsScheme = window.location.protocol === "https:" ? "wss" : "ws";
|
|
|
|
|
|
|
|
const wsUrl = `${wsScheme}://${window.location.host}/ws/ticketroom/${ticketId}/`;;
|
|
|
|
const socket = new WebSocket(wsUrl);
|
|
|
|
const socket = new WebSocket(wsUrl);
|
|
|
|
|
|
|
|
|
|
|
|
socket.onopen = () => {
|
|
|
|
socket.onopen = () => {
|
|
|
|