本文整理汇总了Python中socketio.socketio_manage函数的典型用法代码示例。如果您正苦于以下问题:Python socketio_manage函数的具体用法?Python socketio_manage怎么用?Python socketio_manage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了socketio_manage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __call__
def __call__(self, environ, start_response):
path = environ['PATH_INFO'].strip('/')
# print environ
if not path:
path = 'index.html'
if path.startswith('static/') or path.endswith('html') or path.endswith('js'):
try:
data = open(path).read()
except Exception:
print 'Open path exception'
return not_found(start_response)
if path.endswith(".js"):
content_type = "text/javascript"
elif path.endswith(".css"):
content_type = "text/css"
elif path.endswith(".swf"):
content_type = "application/x-shockwave-flash"
else:
content_type = "text/html"
start_response('200 OK', [('Content-Type', content_type)])
return [data]
if path.startswith("socket.io"):
socketio_manage(environ, {'': OrbitSocket}, self.request)
else:
return not_found(start_response)
开发者ID:stevengunneweg,项目名称:Orbit,代码行数:30,代码来源:server.py
示例2: application
def application(env, start_response):
""" Our web serving app """
path = env['PATH_INFO'].strip('/') or 'index.html'
# static stuff
if path.startswith('static/') or path == "index.html":
try:
data = open(path).read()
except Exception:
return http404(start_response)
if path.endswith(".js"):
content_type = "text/javascript"
elif path.endswith(".css"):
content_type = "text/css"
elif path.endswith(".png"):
content_type = "image/png"
elif path.endswith(".swf"):
content_type = "application/x-shockwave-flash"
else:
content_type = "text/html"
start_response('200 OK', [('Content-Type', content_type)])
return [data]
# socketIO request
if path.startswith('socket.io/'):
socketio_manage(env, {'': LogStreamNS})
else:
return http404(start_response)
开发者ID:Lujeni,项目名称:LogMe,代码行数:30,代码来源:logme.py
示例3: __call__
def __call__(self, environ, start_response):
"""
WSGI application handler.
"""
path = environ["PATH_INFO"]
if path.startswith("/socket.io/"):
socketio_manage(environ, {"": IRCNamespace})
return
if path.startswith("/webhook/"):
dispatch = self.respond_webhook
elif self.django:
dispatch = self.respond_django
else:
dispatch = self.respond_static
response = dispatch(environ)
if isinstance(response, int):
response = (response, [], None)
elif isinstance(response, basestring):
response = (200, [], response)
status, headers, content = response
status_text = HTTP_STATUS_TEXT.get(status, "")
headers.append(("Server", settings.GNOTTY_VERSION_STRING))
start_response("%s %s" % (status, status_text), headers)
if content is None:
if status == 200:
content = ""
else:
content = "<h1>%s</h1>" % status_text.title()
return [content]
开发者ID:mikeywaites,项目名称:gnotty,代码行数:29,代码来源:server.py
示例4: __call__
def __call__(self, environ, start_response):
path = environ['PATH_INFO'].strip('/')
#if path.startswith('static/') or path == 'index.html' or path == 'admin.html':
if path.startswith('static/') or path.endswith('.html'):
try:
data = open(path).read()
except Exception:
return not_found(start_response)
if path.endswith('.js'):
content_type = 'text/javascript'
elif path.endswith('.css'):
content_type = 'text/css'
elif path.endswith('.swf'):
content_type = 'application/x-shockwave-flash'
else:
content_type = 'text/html'
start_response('200 OK', [('Content-Type', content_type)])
return [data]
if path.startswith('socket.io'):
socketio_manage(environ, {'/cloud': CloudNamespace})
else:
return not_found(start_response)
开发者ID:martialblog,项目名称:wordcloud,代码行数:26,代码来源:bluenight.py
示例5: __call__
def __call__(self, environ, start_response):
path = environ["PATH_INFO"].strip("/")
if not path:
start_response("200 OK", [("Content-Type", "text/html")])
return [TestHtml]
if path.startswith("static/") or path.startswith("tests/"):
try:
data = open(path).read()
except Exception:
return not_found(start_response)
if path.endswith(".js"):
content_type = "text/javascript"
elif path.endswith(".css"):
content_type = "text/css"
elif path.endswith(".swf"):
content_type = "application/x-shockwave-flash"
else:
content_type = "text/html"
start_response("200 OK", [("Content-Type", content_type)])
return [data]
if path.startswith("socket.io"):
socketio_manage(environ, {"/test": TestNamespace})
else:
return not_found(start_response)
开发者ID:andrewosenenko,项目名称:gevent-socketio,代码行数:29,代码来源:jstests.py
示例6: view_socketio
def view_socketio(path):
socketio_manage(request.environ, {
"/identity": identity.IdentityNamespace,
"/campaign": campaign.CampaignNamespace,
},
request=current_app._get_current_object(),
)
开发者ID:weltenwort,项目名称:madacra-py,代码行数:7,代码来源:socket.py
示例7: __call__
def __call__(self, environ, start_response):
path = environ['PATH_INFO'].strip('/') or 'index.html'
if path.startswith('/static') or path == 'index.html':
try:
data = open(path).read()
except Exception:
return not_found(start_response)
if path.endswith(".js"):
content_type = "text/javascript"
elif path.endswith(".css"):
content_type = "text/css"
elif path.endswith(".swf"):
content_type = "application/x-shockwave-flash"
else:
content_type = "text/html"
start_response('200 OK', [('Content-Type', content_type)])
return [data]
if path.startswith("socket.io"):
environ['scan_ts'] = self.scan_ts
environ['scan_interval'] = self.scan_interval
cur_ts = datetime.utcnow()
socketio_manage(environ, {'/services': ServicesNamespace,
'/sysinfo': SysinfoNamespace,
'/cpu-widget': CPUWidgetNamespace,
'/memory-widget': MemoryWidgetNamespace,
'/network-widget': NetworkWidgetNamespace,
'/disk-widget': DisksWidgetNamespace,
})
if ((cur_ts - self.scan_ts).total_seconds() > self.scan_interval):
self.scan_ts = cur_ts
开发者ID:JeffWu12138,项目名称:rockstor-core,代码行数:33,代码来源:data_collector.py
示例8: socketio
def socketio(self,remaining):
try:
print request
socketio_manage(request.environ, {'/relay': PersistentConnection}, self)
except:
self.app.logger.error("Exception while handling socketio connection",exc_info=True)
return Response()
开发者ID:polavishnu4444,项目名称:RestApiPerfTester,代码行数:7,代码来源:persistence.py
示例9: handle_socketio_request
def handle_socketio_request(remaining):
try:
socketio_manage(request.environ, {'': BaseNamespace}, request)
except Exception:
current_app.logger.exception('Exception while handling socketio connection')
raise
return current_app.response_class()
开发者ID:Harvard-University-iCommons,项目名称:maildump,代码行数:7,代码来源:web_realtime.py
示例10: __call__
def __call__(self, environ, start_response):
path = environ["PATH_INFO"].strip("/")
if not path:
start_response("200 OK", [("Content-Type", "text/html")])
return ["<h1>Welcome. " 'Try the <a href="/chat.html">chat</a> example.</h1>']
if path.startswith("static/") or path == "chat.html":
try:
data = open(path).read()
except Exception:
return not_found(start_response)
if path.endswith(".js"):
content_type = "text/javascript"
elif path.endswith(".css"):
content_type = "text/css"
elif path.endswith(".swf"):
content_type = "application/x-shockwave-flash"
else:
content_type = "text/html"
start_response("200 OK", [("Content-Type", content_type)])
return [data]
if path.startswith("socket.io"):
socketio_manage(environ, {"": ChatNamespace}, self.request)
else:
return not_found(start_response)
开发者ID:raybit,项目名称:icomment-1,代码行数:29,代码来源:chat.py
示例11: __call__
def __call__(self, environ, start_response):
path = environ['PATH_INFO'].strip('/') or 'index.html'
if path.startswith('static/') or path == 'index.html':
try:
data = open(path).read()
except Exception:
return not_found(start_response)
if path.endswith(".js"):
content_type = "text/javascript"
elif path.endswith(".css"):
content_type = "text/css"
elif path.endswith(".swf"):
content_type = "application/x-shockwave-flash"
else:
content_type = "text/html"
start_response('200 OK', [('Content-Type', content_type)])
return [data]
if path.startswith("socket.io"):
socketio_manage(environ, {'/sys_stat': SystemStatNamespace(self.FILE_DATA)})
else:
return not_found(start_response)
开发者ID:sunhughees,项目名称:gitTests,代码行数:26,代码来源:serve.py
示例12: socket
def socket(remaining):
try:
socketio_manage(request.environ, {'/chat': SocketNS}, request)
except:
app.logger.error('Socket error', exc_info = True)
return Response()
开发者ID:zachhilbert,项目名称:realtime-chat,代码行数:7,代码来源:views.py
示例13: __call__
def __call__(self, environ, start_response):
path = environ['PATH_INFO'].strip('/')
if not path:
start_response('200 OK', [('Content-Type', 'text/html')])
return ['<h1>Welcome. '
'Try the <a href="/chat.html">chat</a> example.</h1>']
root = os.path.dirname(__file__)
if path.startswith('static/') or path == 'chat.html':
path = os.path.join(root, path)
try:
data = open(path).read()
except Exception:
return not_found(start_response)
if path.endswith(".js"):
content_type = "text/javascript"
elif path.endswith(".css"):
content_type = "text/css"
elif path.endswith(".swf"):
content_type = "application/x-shockwave-flash"
else:
content_type = "text/html"
start_response('200 OK', [('Content-Type', content_type)])
return [data]
if path.startswith("socket.io"):
socketio_manage(environ, {'': ChatNamespace}, self.request)
else:
return not_found(start_response)
开发者ID:Awingu,项目名称:chaussette,代码行数:32,代码来源:chat.py
示例14: socketio
def socketio(request):
socketio_manage(request.environ,
{
'': ChatNamespace,
}, request=request
)
return HttpResponse()
开发者ID:hjemmel,项目名称:chat-github,代码行数:7,代码来源:views.py
示例15: __call__
def __call__(self, environ, start_response):
path = environ['PATH_INFO'].strip('/')
if not path:
try:
data = open('chat.html').read()
except Exception:
return not_found(start_response)
start_response('200 OK', [('Content-Type', 'text/html')])
return [data]
if path.startswith('static/'):
try:
data = open(path).read()
except Exception:
return not_found(start_response)
if path.endswith(".js"):
content_type = "text/javascript"
elif path.endswith(".css"):
content_type = "text/css"
else:
content_type = "text/html"
start_response('200 OK', [('Content-Type', content_type)])
return [data]
if path.startswith("socket.io"):
#pdb.set_trace()
socketio_manage(environ, {'': ChatNamespace}, self.request)
else:
return not_found(start_response)
开发者ID:bhairavdhanwade,项目名称:craZyeXp,代码行数:34,代码来源:chatServer.py
示例16: run_socketio
def run_socketio(path):
print 'running socket.io on path %s' % path
socketio_manage(
request.environ,
{#'': ChatNamespace,
'/chat': ChatNamespace,
'/test': TestNamespace})
开发者ID:jackha,项目名称:flask-gevent-socketio-chat,代码行数:7,代码来源:server.py
示例17: __call__
def __call__(self, environ, start_response):
path = environ['PATH_INFO'].strip('/') or 'index.html'
if path.startswith("socket.io"):
socketio_manage(environ, {'/events': EventsNamespace})
else:
return not_found(start_response)
开发者ID:uberj,项目名称:treeherder-service,代码行数:7,代码来源:run_socketio.py
示例18: push_stream
def push_stream(rest):
try:
socketio_manage(request.environ, {'/shouts': ShoutNamespace}, request)
except:
app.logger.error("Exception lors de la connexion socketio",
exc_info=True)
return Response()
开发者ID:sftech2013,项目名称:msg,代码行数:7,代码来源:views.py
示例19: socketio
def socketio(remaining):
try:
socketio_manage(request.environ, {'/ws': VimFoxNamespace}, request)
except:
app.logger.error("Socket Error.", exc_info=True)
return Response()
开发者ID:Mondego,项目名称:pyreco,代码行数:7,代码来源:allPythonContent.py
示例20: socketio
def socketio(remaining):
try:
socketio_manage(request.environ, {'': SessionNamespace}, dict(slug=request.args.get('slug')))
except:
app.logger.error("Exception while handling socketio connection", exc_info=True)
return Response()
开发者ID:henadzit,项目名称:socketexchange,代码行数:7,代码来源:eapp.py
注:本文中的socketio.socketio_manage函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论