ft_transcendence/frontend/static/js/views/Chat.js
2023-11-23 17:40:10 +01:00

22 lines
470 B
JavaScript

import AbstractView from "./AbstractView.js";
export default class extends AbstractView {
constructor(params) {
super(params);
this.setTitle("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>Chat</h1>
`;
}
}