Not Found "/lobby/" django-channels routing error

2018-04-04 Thread Mike Johnson Jr
*routing.py*

*from channels import include, route*
*from chat import consumers*
*from . import game_consumers*

*channel_routing = [*
* #game routing*
* route('websocket.connect', game_consumers.ws_connect_lobby, 
path=r"^/lobby/$"),*
*route('websocket.receive', game_consumers.ws_receive_lobby, 
path=r"^/lobby/$"),*
*route('websocket.disconnect', game_consumers.ws_disconnect_lobby, 
path=r"^/lobby/$"),*

*app.js*

*Websocket = {*
*lobby_socket: null,*
*setup_ws_lobby : function(){*
* Websocket.lobby_socket = new 
ReconnectingWebSocket(Websocket.ws_scheme + '://' + window.location.host + 
'/lobby/');*
* Websocket.lobby_socket.onmessage = function(message) {*
* //nothing yet*
*};*
* },*
*}*
*Websocket.setup_ws_lobby();*

*The url is `127.0.0.1:8000/game`. `Websocket.setup_ws_lobby()` is executed 
on page load. I don't see what I'm doing wrong. I get the error `Not Found: 
/lobby/` in my `python manage.py runserver` console when I load the page. 
My routes are clearly set and my js setup seems to route to those routes. 
Can anyone help? Thanks in advance.*

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/4c8048eb-3603-45fa-b518-49658b8766cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Websocket, django-channels - an existing connection was forcibly closed by the remote host

2017-06-25 Thread Mike Johnson Jr


So I'm getting the error as described in the title of this post.

I'm following this tutorial: 
https://gearheart.io/blog/creating-a-chat-with-django-channels/

Here's the full traceback:

In [1]: import websocket
In [2]: ws = websocket.WebSocket()
In [3]: 
ws.connect("ws://localhost:8000")---
error Traceback (most recent call 
last) in ()> 1 
ws.connect("ws://localhost:8000")

c:\Python27\lib\site-packages\websocket\_core.pyc in connect(self, url, 
**options)
212
213 try:--> 214 self.handshake_response = 
handshake(self.sock, *addrs, **options)
215 self.connected = True
216 except:

c:\Python27\lib\site-packages\websocket\_handshake.pyc in handshake(sock, 
hostname, por
t, resource, **options)
 67 dump("request header", header_str)
 68---> 69 status, resp = _get_resp_headers(sock)
 70 success, subproto = _validate(resp, key, 
options.get("subprotocols"))
 71 if not success:

c:\Python27\lib\site-packages\websocket\_handshake.pyc in 
_get_resp_headers(sock, succe
ss_status)
125
126 def _get_resp_headers(sock, success_status=101):--> 127 status, 
resp_headers = read_headers(sock)
128 if status != success_status:
129 raise WebSocketBadStatusException("Handshake status %d", status)

c:\Python27\lib\site-packages\websocket\_http.pyc in read_headers(sock)
224
225 while True:--> 226 line = recv_line(sock)
227 line = line.decode('utf-8').strip()
228 if not line:

c:\Python27\lib\site-packages\websocket\_socket.pyc in recv_line(sock)
 99 line = []
100 while True:--> 101 c = recv(sock, 1)
102 line.append(c)
103 if c == six.b("\n"):

c:\Python27\lib\site-packages\websocket\_socket.pyc in recv(sock, bufsize)
 78
 79 try:---> 80 bytes_ = sock.recv(bufsize)
 81 except socket.timeout as e:
 82 message = extract_err_message(e)

error: [Errno 10054] An existing connection was forcibly closed by the remote 
host

I have redis running, manage.py runserver running, and I'm using 
django-channels. This is my first time working with websockets. Can anyone 
help out and let me know what's wrong?
python  django 
 websocket 
 redis 
 django-channels 


-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/4a44de8f-3c64-4eb7-a71d-d575c192b72f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.