Module Contents¶
Classes¶
Root resource when you want a WSGI resource be the default serving |
|
A Twisted Web resource for WebSocket. |
- class autobahn.twisted.resource.WSGIRootResource(wsgiResource, children)[source]¶
Bases:
twisted.web.resource.Resource
Root resource when you want a WSGI resource be the default serving resource for a Twisted Web site, but have subpaths served by different resources.
This is a hack needed since twisted.web.wsgi.WSGIResource. does not provide a
putChild()
method.- getChild(path, request)[source]¶
Retrieve a ‘child’ resource from me.
Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().
This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.
For example, the URL /foo/bar/baz will normally be:
| site.resource.getChild('foo').getChild('bar').getChild('baz').
However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.
Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.
- class autobahn.twisted.resource.WebSocketResource(factory)[source]¶
Bases:
object
A Twisted Web resource for WebSocket.
- isLeaf = True¶
- getChildWithDefault(name, request)[source]¶
This resource cannot have children, hence this will always fail.
- render(request)[source]¶
Render the resource. This will takeover the transport underlying the request, create a
autobahn.twisted.websocket.WebSocketServerProtocol
and let that do any subsequent communication.