From c2b4f8d7de00c9c4ade235dcc4f02883a0219762 Mon Sep 17 00:00:00 2001
From: Marvin Borner
Date: Sun, 6 May 2018 00:28:48 +0200
Subject: Added wormhole and other things
---
main/app/sprinkles/core/assets/SiteAssets/js/chat.js | 1 +
.../SiteAssets/php/Chatserver/src/ChatProcessor.php | 18 +++---------------
2 files changed, 4 insertions(+), 15 deletions(-)
(limited to 'main/app/sprinkles/core/assets')
diff --git a/main/app/sprinkles/core/assets/SiteAssets/js/chat.js b/main/app/sprinkles/core/assets/SiteAssets/js/chat.js
index 82cae93..ebf549b 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/js/chat.js
+++ b/main/app/sprinkles/core/assets/SiteAssets/js/chat.js
@@ -15,6 +15,7 @@ function InitializeChatServer() {
}, 5000);
};
ChatSocket.onopen = function () {
+ ChatSocket.send(JSON.stringify({ClientMessageType: "Verify", Cookie: document.cookie}));
// CONNECTION SUCCESSFUL!
console.log("[WEBSOCKET LOGGER] Chat connection established!");
// GOT MESSAGE
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/Chatserver/src/ChatProcessor.php b/main/app/sprinkles/core/assets/SiteAssets/php/Chatserver/src/ChatProcessor.php
index f3793e2..1385f19 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/Chatserver/src/ChatProcessor.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/Chatserver/src/ChatProcessor.php
@@ -29,21 +29,6 @@ class ChatProcessor implements MessageComponentInterface
$this->connectedUsersNames[$conn->resourceId] = $generator->getName();
}
- /*public function onMessage(ConnectionInterface $from, $msg) {
- $numRecv = count($this->clients) - 1;
- echo sprintf('Connection %d sending message "%s" to %d other connection%s' . "\n"
- , $from->resourceId, $msg, $numRecv, $numRecv == 1 ? '' : 's');
-
- foreach ($this->clients as $client) {
- if ($from === $client) {
- $client->send("You - " . $msg);
- } else {
- $client->send("" . $from->resourceId . " - " . $msg);
- }
- }
- }
- */
-
public function onMessage(ConnectionInterface $conn, MessageInterface $msg) {
$data = json_decode($msg);
switch ($data->ClientMessageType) {
@@ -109,6 +94,9 @@ class ChatProcessor implements MessageComponentInterface
}
}
break;
+ case "Verify":
+ print_r($data);
+ break;
}
}
--
cgit v1.2.3