Skip to content

Commit

Permalink
Use django integration in django_chat example
Browse files Browse the repository at this point in the history
  • Loading branch information
wuzuf committed Aug 4, 2012
1 parent 4c5ddda commit ba828bc
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 8 deletions.
2 changes: 2 additions & 0 deletions examples/django_chat/chat/chat_socketio.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

from socketio.namespace import BaseNamespace
from socketio.mixins import RoomsMixin, BroadcastMixin
from socketio.sdjango import namespace

@namespace('/chat')
class ChatNamespace(BaseNamespace, RoomsMixin, BroadcastMixin):
nicknames = []

Expand Down
2 changes: 1 addition & 1 deletion examples/django_chat/chat/static/js/chat.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// socket.io specific code
var socket = io.connect();
var socket = io.connect("/chat");

socket.on('connect', function () {
$('#chat').addClass('connected');
Expand Down
4 changes: 2 additions & 2 deletions examples/django_chat/chat/urls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

from django.conf.urls.defaults import patterns, include, url

import socketio.sdjango

urlpatterns = patterns("chat.views",
url("^socket\.io", "socketio", name="socketio"),
url("^socket\.io", include(socketio.sdjango.urls)),
url("^$", "rooms", name="rooms"),
url("^create/$", "create", name="create"),
url("^(?P<slug>.*)$", "room", name="room"),
Expand Down
4 changes: 0 additions & 4 deletions examples/django_chat/chat/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
from chat.models import ChatRoom
from chat.chat_socketio import ChatNamespace

def socketio(request):
socketio_manage(request.environ, {'': ChatNamespace}, request)
return HttpResponse("")

def rooms(request, template="rooms.html"):
"""
Homepage - lists all rooms.
Expand Down
1 change: 0 additions & 1 deletion socketio/sdjango.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def __call__(self, handler):


def socketio(request):
logging.getLogger("socketio").info(repr(SOCKETIO_NS))
try:
socketio_manage(request.environ, SOCKETIO_NS, request)
except:
Expand Down

0 comments on commit ba828bc

Please sign in to comment.