Skip to content

Make interface look like gevent-websocket#1

Open
denik wants to merge 5 commits into
progrium:masterfrom
denik:master
Open

Make interface look like gevent-websocket#1
denik wants to merge 5 commits into
progrium:masterfrom
denik:master

Conversation

@denik

@denik denik commented Oct 8, 2011

Copy link
Copy Markdown

The upgradeable middleware was simplified but I believe it became more powerful because of it.

Please take a look.

This also includes a chat example ported to geventserver.

Lawouach and others added 4 commits October 2, 2011 01:20
Added io_loop parameter to TornadoWebSocketClient constructor
* ws4py.server.geventserver.WebSocketServer can now be used as the server
  from gevent-websocket

* Made middleware call the application if the request is regular HTTP and
  not WebSocket.

* Converted UpgradableWSGIHandle into something more simpler, that just
  exposes the underline socket always and gives application means to take
  ownership of it.

  This works as following:
  1) UpgradableWSGIHandle sets environ['wsgi.socket'] to connection's socket.
  2) After the application is done, UpgradableWSGIHandle checks if
     environ['wsgi.socket.detach'] flag is set. If it is, it silently exits
     without processing application's return value, reading/writing anything
     from the socket. The socket is not closed by the server.

  This functionality probably can be moved into gevent server. It can also be
  implemented by other servers.

* Switched arguments: replaced APP(websocket, environ) with APP(environ, websocket)
  That way the same application callable can be used for HTTP and WebSocket apps.
@denik

denik commented Oct 8, 2011

Copy link
Copy Markdown
Author

fixed example to work on firefox7

@denik

denik commented Oct 8, 2011

Copy link
Copy Markdown
Author

I've said that I swapped argument of application callable (put environ on the first place and websocket on the second) but it's not what I actually did. Instead I'm passing None as a second argument.

I think I like it even better. That way everyone is forced to use environ['wsgi.websocket'].

The last commit fixes main section in geventserver.py w.r.t that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants