On Sat, May 3, 2014 at 7:21 PM, Jesse Ferguson <[email protected]> wrote:
> OK so I've been reading/researching and I'm still trying to wrap my head
> around how the above code works,
>
> First let me define what I *think* is going on,
>
> The script imports socket.io modules needed and the imports web2py's
> wsgibase...
>
> SocketIOServer (('0.0.0.0', 8080), wsgibase,
> resource="socket.io").serve_forever()
>
>
> This passes the SocketIOServer on localhost port 8080 to wsgibase,
>
Any wsgi application needs to expose a callable handler to a WSGI server.
wsgibase is the web2py one.
Im still not clear on what resource="socket.io" does... in the source of
> socketioserver it seems to be the default setting anyways not sure if its
> important or not... finally serve_forever() starts the server loop...
>
from https://github.com/LearnBoost/socket.io/wiki/Configuring-Socket.IO:
-
*resource* defaults to /socket.io
- The begin point where Socket.IO starts looking for incoming
connections. This should be the same between the client and the server.
Client-side prepends this value with /. Server-side does not.
so resource="socketio" is the entry point where the connection upgrade
happens,
in other words, is the entry point to establish a persistent tcp connection
between server and client.
>
>
> This leaves me with a few questions...
> 1) So whats actually serving the webpage here!? Is socketIOserver the http
> server? or the WSGI server? Both?
>
it's SocketIOServer that is serving, but SocketIOServer is a subclass of
gevent WSGIServer, so in the end
is gevent WSGIServer.
> 2)This seams to break some of web2py's functionality for example the admin
> page will complain that there was not a password set, changing the code to
> start the server on port 8000 seemed to fix it...
>
You need a web2py/parameters_????.py where ???? must be the port number.
If you want to run the server on port 5000 for example just copy
parameters_8000.py to parameters_5000.py in web2py folder.
3)Overall I guess I'm just new to the whole architecture flow and unsure of
> what does what, Im slowly breaking it down by reading source code, If
> anyone knows of any specific docs that i should check out please point me
> to it :)
>
You should be familiar with:
python wsgi
websockets
Socket.io
gevent-socketio
and of course web2py
> 4)Having the chat example running on my local machine is awesome however
> I'm still unsure of how I would deploy it...
>
you can put nginx in front of it.
http://nginx.org/en/docs/http/websocket.html
Regargs,
Ricardo
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.