Converted webclient to use websockets on port 8001. Ideally one would make it so the ajax and websocket clients work under the same django wrapper, but for now this functionality is elusive.

This commit is contained in:
Griatch 2014-06-15 21:58:53 +02:00
parent 2a6cfaca7d
commit ede6634081
11 changed files with 326 additions and 37 deletions

View file

@ -8,7 +8,7 @@ page and serve it eventual static content.
from django.shortcuts import render_to_response, redirect
from django.template import RequestContext
from django.conf import settings
from src.server.sessionhandler import SESSIONS
from src.players.models import PlayerDB
def webclient(request):
"""
@ -21,8 +21,9 @@ def webclient(request):
print "Called from port 8000!"
#return redirect("http://localhost:8001/webclient/", permanent=True)
nsess = len(PlayerDB.objects.get_connected_players()) or "none"
# as an example we send the number of connected players to the template
pagevars = {'num_players_connected': SESSIONS.player_count()}
pagevars = {'num_players_connected': nsess}
context_instance = RequestContext(request)
return render_to_response('webclient.html', pagevars, context_instance)