Change chat channel to node websocket
This commit is contained in:
parent
aeda77b924
commit
231687e081
12 changed files with 308 additions and 280 deletions
|
@ -1,12 +0,0 @@
|
|||
from channels.auth import AuthMiddlewareStack
|
||||
from channels.routing import ProtocolTypeRouter, URLRouter
|
||||
import chat_box.routing
|
||||
|
||||
application = ProtocolTypeRouter({
|
||||
# (http->django views is added by default)
|
||||
'websocket': AuthMiddlewareStack(
|
||||
URLRouter(
|
||||
chat_box.routing.websocket_urlpatterns
|
||||
)
|
||||
),
|
||||
})
|
|
@ -243,7 +243,6 @@ INSTALLED_APPS += (
|
|||
'impersonate',
|
||||
'django_jinja',
|
||||
'chat_box',
|
||||
'channels',
|
||||
'newsletter',
|
||||
)
|
||||
|
||||
|
@ -513,17 +512,6 @@ FILE_UPLOAD_PERMISSIONS = 0o644
|
|||
|
||||
MESSAGES_TO_LOAD = 15
|
||||
|
||||
ASGI_APPLICATION = 'dmoj.routing.application'
|
||||
CHANNEL_LAYERS = {
|
||||
'default': {
|
||||
'BACKEND': 'channels_redis.core.RedisChannelLayer',
|
||||
'CONFIG': {
|
||||
"hosts": [('0.0.0.0', 6379)],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
NEWSLETTER_CONFIRM_EMAIL = False
|
||||
|
||||
# Amount of seconds to wait between each email. Here 100ms is used.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from chat_box.views import ChatView, delete_message
|
||||
from chat_box.views import ChatView, delete_message, post_message, chat_message_ajax, online_status_ajax
|
||||
from django.conf import settings
|
||||
from django.conf.urls import include, url
|
||||
from django.contrib import admin
|
||||
|
@ -372,8 +372,10 @@ urlpatterns = [
|
|||
url(r'^$',
|
||||
login_required(ChatView.as_view()),
|
||||
name='chat'),
|
||||
url(r'^delete/$', delete_message, name='delete_message')
|
||||
|
||||
url(r'^delete/$', delete_message, name='delete_chat_message'),
|
||||
url(r'^post/$', post_message, name='post_chat_message'),
|
||||
url(r'^ajax$', chat_message_ajax, name='chat_message_ajax'),
|
||||
url(r'^online_status/ajax$', online_status_ajax, name='online_status_ajax')
|
||||
])),
|
||||
|
||||
url(r'^notifications/',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue