You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once upon a time, based on flask-websocket; Copyright (C) 2013 Kenneth Reitz
3
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6
-
"""
7
-
8
-
# -*- coding: utf-8 -*-
9
-
10
-
fromwerkzeug.exceptionsimportNotFound
11
-
fromwerkzeug.httpimportparse_cookie
12
-
fromflaskimportrequest
13
-
14
-
fromflask.helpersimport_endpoint_from_view_func
15
-
fromwerkzeug.routingimportMap, Rule, BuildError
16
-
17
1
from .representationsimportencode_json
18
2
19
3
@@ -25,158 +9,3 @@ def emit(self, event: dict):
25
9
response=encode_json(event)
26
10
# TODO: Logic surrounding if this subscriber is subscribed to the requested event type
27
11
self.ws.send(response)
28
-
29
-
30
-
classWsUrlAdapterWrapper(object):
31
-
def__init__(self, app_adapter, sockets_adapter):
32
-
self.__app_adapter=app_adapter
33
-
self.__sockets_adapter=sockets_adapter
34
-
35
-
defbuild(
36
-
self,
37
-
endpoint,
38
-
values=None,
39
-
method=None,
40
-
force_external=False,
41
-
append_unknown=True,
42
-
):
43
-
try:
44
-
return (
45
-
"ws"
46
-
+self.__sockets_adapter.build(
47
-
endpoint=endpoint,
48
-
values=values,
49
-
method=None,
50
-
force_external=True,
51
-
append_unknown=append_unknown,
52
-
)[4:]
53
-
)
54
-
exceptBuildError:
55
-
returnself.__app_adapter.build(
56
-
endpoint=endpoint,
57
-
values=values,
58
-
method=method,
59
-
force_external=force_external,
60
-
append_unknown=append_unknown,
61
-
)
62
-
63
-
def__getattr__(self, attr):
64
-
fun=getattr(self.__app_adapter, attr)
65
-
setattr(self, attr, fun)
66
-
returnfun
67
-
68
-
69
-
classSockets:
70
-
def__init__(self, app=None):
71
-
#: Compatibility with 'Flask' application.
72
-
#: The :class:`~werkzeug.routing.Map` for this instance. You can use
73
-
#: this to change the routing converters after the class was created
74
-
#: but before any routes are connected.
75
-
self.url_map=Map()
76
-
77
-
#: Compatibility with 'Flask' application.
78
-
#: All the attached blueprints in a dictionary by name. Blueprints
79
-
#: can be attached multiple times so this dictionary does not tell
0 commit comments