aboutsummaryrefslogtreecommitdiffhomepage
path: root/chat.php
diff options
context:
space:
mode:
Diffstat (limited to 'chat.php')
-rwxr-xr-xchat.php35
1 files changed, 0 insertions, 35 deletions
diff --git a/chat.php b/chat.php
deleted file mode 100755
index 10d8f2d..0000000
--- a/chat.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<input title="MessageInput" id="MessageInput" type="text" placeholder="Message"/>
-<input title="SubscribeInput" id="SubscribeInput" type="text" placeholder="Subscribe"/>
-<div id="Response"></div>
-
-<script src="https://code.jquery.com/jquery-latest.min.js"></script>
-<script>
- function subscribe(channel) {
- conn.send(JSON.stringify({command: "subscribe", channel: channel}));
- $("#Response").empty();
- }
-
- function sendMessage(msg) {
- conn.send(JSON.stringify({command: "message", message: msg}));
- $("#MessageInput").val("");
- }
-
- var conn = new WebSocket('wss://marvinborner.ddnss.de:1337');
- conn.onopen = function () {
- console.log("Connection established!");
- };
- conn.onmessage = function (e) {
- document.getElementById("Response").innerHTML += e.data + "<br>";
- };
- $('#MessageInput').keyup(function (e) {
- if (e.keyCode === 13) {
- sendMessage($('#MessageInput').val());
- $('#MessageInput').val("");
- }
- });
- $('#SubscribeInput').keyup(function (e) {
- if (e.keyCode === 13) {
- subscribe($('#SubscribeInput').val());
- }
- });
-</script> \ No newline at end of file