diff --git a/webapp/titanembeds/app.py b/webapp/titanembeds/app.py
index 2840149..f8bcf4e 100644
--- a/webapp/titanembeds/app.py
+++ b/webapp/titanembeds/app.py
@@ -3,7 +3,7 @@ from .database import db
from flask import Flask, render_template, request, session, url_for, redirect, jsonify
from flask_sslify import SSLify
from titanembeds.utils import rate_limiter, discord_api, bot_alive, socketio
-from .blueprints import api, user, admin, embed
+from .blueprints import api, user, admin, embed, gateway
import os
from titanembeds.database import get_administrators_list
@@ -26,6 +26,7 @@ app.register_blueprint(api.api, url_prefix="/api", template_folder="/templates")
app.register_blueprint(admin.admin, url_prefix="/admin", template_folder="/templates")
app.register_blueprint(user.user, url_prefix="/user", template_folder="/templates")
app.register_blueprint(embed.embed, url_prefix="/embed", template_folder="/templates")
+socketio.on_namespace(gateway.Gateway('/gateway'))
@app.route("/")
def index():
diff --git a/webapp/titanembeds/blueprints/gateway/__init__.py b/webapp/titanembeds/blueprints/gateway/__init__.py
new file mode 100644
index 0000000..0abc29c
--- /dev/null
+++ b/webapp/titanembeds/blueprints/gateway/__init__.py
@@ -0,0 +1 @@
+from .gateway import Gateway
diff --git a/webapp/titanembeds/blueprints/gateway/gateway.py b/webapp/titanembeds/blueprints/gateway/gateway.py
new file mode 100644
index 0000000..0fc7c91
--- /dev/null
+++ b/webapp/titanembeds/blueprints/gateway/gateway.py
@@ -0,0 +1,6 @@
+from titanembeds.utils import socketio
+from flask_socketio import Namespace, emit
+
+class Gateway(Namespace):
+ def on_connect(self):
+ emit('key', {'data': 'Connected', 'best_pone': "rainbow"})
\ No newline at end of file
diff --git a/webapp/titanembeds/static/js/embed.js b/webapp/titanembeds/static/js/embed.js
index a63e164..6ac64c5 100644
--- a/webapp/titanembeds/static/js/embed.js
+++ b/webapp/titanembeds/static/js/embed.js
@@ -7,6 +7,8 @@
/* global localStorage */
/* global visitors_enabled */
/* global cheet */
+/* global location */
+/* global io */
(function () {
const theme_options = ["DiscordDark", "BetterTitan"]; // All the avaliable theming names
@@ -247,6 +249,12 @@
} else {
primeEmbed();
}
+
+ /* SocketIO Test */
+ var socket = io.connect(location.protocol + '//' + document.domain + ':' + location.port + "/gateway");
+ socket.on('connect', function() {
+ console.log("Socket.IO Connected!");
+ });
});
function changeTheme(theme=null, keep_custom_css=true) {
diff --git a/webapp/titanembeds/templates/embed.html.j2 b/webapp/titanembeds/templates/embed.html.j2
index 60849a9..6211189 100644
--- a/webapp/titanembeds/templates/embed.html.j2
+++ b/webapp/titanembeds/templates/embed.html.j2
@@ -197,6 +197,7 @@
+
{% raw %}