Make interface look like gevent-websocket#1
Open
denik wants to merge 5 commits into
Open
Conversation
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.
Author
|
fixed example to work on firefox7 |
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.