mirror of https://github.com/interlegis/sapl.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
935 B
34 lines
935 B
<!-- chat/templates/chat/room.html -->
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8"/>
|
|
<title>Chat Room</title>
|
|
</head>
|
|
<body>
|
|
<textarea id="chat-log" cols="100" rows="20"></textarea><br/>
|
|
<input id="chat-message-submit" type="button" value="Pull"/>
|
|
</body>
|
|
<script>
|
|
|
|
var chatSocket = new WebSocket(
|
|
(window.location.protocol === 'https:' ? 'wss://' : 'ws://') + window.location.host +
|
|
'/ws/time-refresh/');
|
|
|
|
chatSocket.onmessage = function(e) {
|
|
var data = JSON.parse(e.data);
|
|
var message = data['message'];
|
|
document.querySelector('#chat-log').value += (e.data + '\n');
|
|
};
|
|
|
|
chatSocket.onclose = function(e) {
|
|
console.error('Chat socket closed unexpectedly');
|
|
};
|
|
|
|
document.querySelector('#chat-message-submit').onclick = function(e) {
|
|
chatSocket.send(JSON.stringify({
|
|
'message': 'OK'
|
|
}));
|
|
};
|
|
</script>
|
|
</html>
|