ft_transcendence/frontend/static/js/views/GeneralChat.js

23 lines
487 B
JavaScript
Raw Normal View History

2023-11-22 09:50:42 -05:00
import AbstractView from "./AbstractView.js";
export default class extends AbstractView {
constructor(params) {
super(params);
this.setTitle("General Chat");
let url = `ws://${window.location.host}/ws/socket-server/`
const chatSocket = new WebSocket(url)
chatSocket.onmessage = function(e) {
let data = JSON.parse(e.data)
console.log('Data:', data)
}
}
async getHtml() {
return `
<h1>General Chat</h1>
`;
}
}