webockets routes

This commit is contained in:
Holger Trampe 2020-05-19 21:24:48 +02:00
parent 72d2f3854f
commit d8dc365b03
5 changed files with 6 additions and 6 deletions

View File

@ -121,10 +121,10 @@ $(document).ready(function(){
ws_string = 'ws://' ws_string = 'ws://'
} }
if(typeof chatwebsocket != "undefined"){ if(typeof chatwebsocket != "undefined"){
chatwebsocket = new WebSocket(ws_string+window.location.host+"/chat/{{roomdata.creator.pk}}/{{roomdata.chatmember_single.pk}}/") chatwebsocket = new WebSocket(ws_string+window.location.host+"/ws/chat/{{roomdata.creator.pk}}/{{roomdata.chatmember_single.pk}}/")
} }
else{ else{
chatwebsocket = new WebSocket(ws_string+window.location.host+"/chat/{{roomdata.creator.pk}}/{{roomdata.chatmember_single.pk}}/") chatwebsocket = new WebSocket(ws_string+window.location.host+"/ws/chat/{{roomdata.creator.pk}}/{{roomdata.chatmember_single.pk}}/")
} }

View File

@ -60,7 +60,7 @@ X_FRAME_OPTIONS = 'SAMEORIGIN'
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '_qv2t2lmsctjxpbb4rrp=op%_20_hxzonv^mvty1o85c)l$s^q' SECRET_KEY = '_qv2t2lmsctjxpbb4rrp=op%_20_hxzonv^mvty1o85c)l$s^q'
ALLOWED_HOSTS = ['digitale-agentur.com', 'www.digitale-agentur.com', '127.0.0.1', 'dev01.digitale-agentur.com', '10.0.2.2'] ALLOWED_HOSTS = ['digitale-agentur.com', 'www.digitale-agentur.com', '127.0.0.1', 'localhost', 'dev01.digitale-agentur.com', '10.0.2.2']
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [

View File

@ -3,6 +3,6 @@ from django.urls import re_path
from . import mainwebsocket from . import mainwebsocket
websocket_urlpatterns = [ websocket_urlpatterns = [
re_path(r'chat/(?P<creator>\w+)/(?P<single>\w+)/$', mainwebsocket.UsersChat), re_path(r'ws/chat/(?P<creator>\w+)/(?P<single>\w+)/$', mainwebsocket.UsersChat),
re_path('main/', mainwebsocket.UsersConsumer), re_path('ws/', mainwebsocket.UsersConsumer),
] ]

View File

@ -659,7 +659,7 @@ $(document).ready(function(){
ws_string = 'ws://' ws_string = 'ws://'
} }
const mainwebsocket = new WebSocket(ws_string+window.location.host+"/main/") const mainwebsocket = new WebSocket(ws_string+window.location.host+"/ws/")
mainwebsocket.onmessage = function(e) { mainwebsocket.onmessage = function(e) {
if(e["data"] != "presence_update") if(e["data"] != "presence_update")