# Path: flask_sockets.py
# class Sockets(object):
# 
#     def __init__(self, app=None):
#         self.app = app
# 
#     def route(self, rule, **options):
# 
#         def decorator(f):
#             @wraps(f)
#             def inner(*args, **kwargs):
#                 return f(request.environ['wsgi.websocket'], *args, **kwargs)
# 
#             if self.app:
#                 endpoint = options.pop('endpoint', None)
#                 self.app.add_url_rule(rule, endpoint, inner, **options)
#             return inner
# 
#         return decorator


from gevent.monkey import patch_time
from flask import Flask
from flask_sockets import Sockets
from geventwebsocket import WebSocketError
from time import sleep
#!/usr/bin/env python

from __future__ import print_function

patch_time()


app = Flask(__name__)
sockets = Sockets(app)


@sockets.route('/data')
def data_socket(ws):
    data = 0

# Path: flask_sockets.py
# class Sockets(object):
# 
#     def __init__(self, app=None):
#         self.app = app
# 
#     def route(self, rule, **options):
# 
#         def decorator(f):
#             @wraps(f)
#             def inner(*args, **kwargs):
#                 return f(request.environ['wsgi.websocket'], *args, **kwargs)
# 
#             if self.app:
#                 endpoint = options.pop('endpoint', None)
#                 self.app.add_url_rule(rule, endpoint, inner, **options)
#             return inner
# 
#         return decorator


# Path: temp_misc/ws_test/server.py
from gevent.monkey import patch_time
from flask import Flask
from flask_sockets import Sockets
from geventwebsocket import WebSocketError
from time import sleep

#!/usr/bin/env python

from __future__ import print_function

patch_time()


app = Flask(__name__)
sockets = Sockets(app)


@sockets.route('/data')
def data_socket(ws):
    data = 0

    while True: