gevent-websocket / geventwebsocket / protocols / base.py

class BaseProtocol(object):
    PROTOCOL_NAME = ""

    def __init__(self, app):
        self._app = app

    def on_open(self):
        self.app.on_open()

    def on_message(self, message):
        self.app.on_message(message)

    def on_close(self):
        self.app.on_close()

    @property
    def app(self):
        if self._app:
            return self._app
        else:
            raise Exception("No application coupled")

    @property
    def server(self):
        if not hasattr(self.app, 'ws'):
            return None

        return self.app.ws.handler.server

    @property
    def handler(self):
        if not hasattr(self.app, 'ws'):
            return None

        return self.app.ws.handler
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.