wslink 1.11.0__py3-none-any.whl → 1.11.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wslink/backends/aiohttp/__init__.py +9 -7
- wslink/backends/generic/core.py +7 -14
- wslink/protocol.py +18 -13
- {wslink-1.11.0.dist-info → wslink-1.11.2.dist-info}/METADATA +2 -2
- {wslink-1.11.0.dist-info → wslink-1.11.2.dist-info}/RECORD +7 -7
- {wslink-1.11.0.dist-info → wslink-1.11.2.dist-info}/WHEEL +1 -1
- {wslink-1.11.0.dist-info → wslink-1.11.2.dist-info}/top_level.txt +0 -0
@@ -35,10 +35,10 @@ def _fix_path(path):
|
|
35
35
|
# -----------------------------------------------------------------------------
|
36
36
|
|
37
37
|
|
38
|
-
class WebAppServer(AbstractWebApp
|
38
|
+
class WebAppServer(AbstractWebApp):
|
39
39
|
def __init__(self, server_config):
|
40
40
|
AbstractWebApp.__init__(self, server_config)
|
41
|
-
aiohttp_web.Application
|
41
|
+
self.set_app(aiohttp_web.Application())
|
42
42
|
self._ws_handlers = []
|
43
43
|
self._site = None
|
44
44
|
self._runner = None
|
@@ -52,7 +52,7 @@ class WebAppServer(AbstractWebApp, aiohttp_web.Application):
|
|
52
52
|
aiohttp_web.get(_fix_path(route), protocol_handler.handleWsRequest)
|
53
53
|
)
|
54
54
|
|
55
|
-
self.add_routes(routes)
|
55
|
+
self.app.add_routes(routes)
|
56
56
|
|
57
57
|
if "static" in server_config:
|
58
58
|
static_routes = server_config["static"]
|
@@ -68,10 +68,10 @@ class WebAppServer(AbstractWebApp, aiohttp_web.Application):
|
|
68
68
|
)
|
69
69
|
|
70
70
|
# Resolve / => index.html
|
71
|
-
self.router.add_route("GET", "/", _root_handler)
|
72
|
-
self.add_routes(routes)
|
71
|
+
self.app.router.add_route("GET", "/", _root_handler)
|
72
|
+
self.app.add_routes(routes)
|
73
73
|
|
74
|
-
self["state"] = {}
|
74
|
+
self.app["state"] = {}
|
75
75
|
|
76
76
|
# -------------------------------------------------------------------------
|
77
77
|
# Server status
|
@@ -94,7 +94,9 @@ class WebAppServer(AbstractWebApp, aiohttp_web.Application):
|
|
94
94
|
# -------------------------------------------------------------------------
|
95
95
|
|
96
96
|
async def start(self, port_callback=None):
|
97
|
-
self._runner = aiohttp_web.AppRunner(
|
97
|
+
self._runner = aiohttp_web.AppRunner(
|
98
|
+
self.app, handle_signals=self.handle_signals
|
99
|
+
)
|
98
100
|
|
99
101
|
logging.info("awaiting runner setup")
|
100
102
|
await self._runner.setup()
|
wslink/backends/generic/core.py
CHANGED
@@ -1,12 +1,5 @@
|
|
1
1
|
import asyncio
|
2
|
-
import copy
|
3
|
-
import os
|
4
|
-
import inspect
|
5
|
-
import json
|
6
2
|
import logging
|
7
|
-
import re
|
8
|
-
import sys
|
9
|
-
import traceback
|
10
3
|
import uuid
|
11
4
|
from pathlib import Path
|
12
5
|
import shutil
|
@@ -14,7 +7,7 @@ import shutil
|
|
14
7
|
from wslink.protocol import WslinkHandler, AbstractWebApp
|
15
8
|
|
16
9
|
|
17
|
-
class
|
10
|
+
class WsConnection:
|
18
11
|
def __init__(self):
|
19
12
|
self._id = str(uuid.uuid4()).replace("-", "")
|
20
13
|
self._ws = None
|
@@ -58,15 +51,15 @@ class Client:
|
|
58
51
|
await self._on_message_fn(True, value)
|
59
52
|
|
60
53
|
|
61
|
-
class
|
54
|
+
class WsEndpoint(WslinkHandler):
|
62
55
|
def __init__(self, protocol=None, web_app=None):
|
63
56
|
super().__init__(protocol, web_app)
|
64
57
|
|
65
58
|
def connect(self):
|
66
|
-
|
67
|
-
self.connections[
|
68
|
-
|
69
|
-
return
|
59
|
+
conn = WsConnection()
|
60
|
+
self.connections[conn.client_id] = conn
|
61
|
+
conn.on_connect(self)
|
62
|
+
return conn
|
70
63
|
|
71
64
|
def disconnect(self, client_or_id):
|
72
65
|
client_or_id = (
|
@@ -84,7 +77,7 @@ class GenericServer(AbstractWebApp):
|
|
84
77
|
|
85
78
|
if "ws" in server_config:
|
86
79
|
for route, server_protocol in server_config["ws"].items():
|
87
|
-
protocol_handler =
|
80
|
+
protocol_handler = WsEndpoint(server_protocol, self)
|
88
81
|
self._websockets[route] = protocol_handler
|
89
82
|
|
90
83
|
def write_static_content(self, dest_directory):
|
wslink/protocol.py
CHANGED
@@ -7,7 +7,7 @@ import re
|
|
7
7
|
import traceback
|
8
8
|
|
9
9
|
from wslink import schedule_coroutine
|
10
|
-
from wslink import
|
10
|
+
from wslink.publish import PublishManager
|
11
11
|
|
12
12
|
|
13
13
|
class AbstractWebApp:
|
@@ -16,6 +16,7 @@ class AbstractWebApp:
|
|
16
16
|
self._config = server_config
|
17
17
|
self._shutdown_task = None
|
18
18
|
self._completion = asyncio.get_event_loop().create_future()
|
19
|
+
self._app = None
|
19
20
|
|
20
21
|
# -------------------------------------------------------------------------
|
21
22
|
# Config helper
|
@@ -58,11 +59,22 @@ class AbstractWebApp:
|
|
58
59
|
self._last_active_client_id = value
|
59
60
|
|
60
61
|
# -------------------------------------------------------------------------
|
61
|
-
#
|
62
|
+
# Implementation server class
|
62
63
|
# -------------------------------------------------------------------------
|
63
64
|
|
64
|
-
def set_app(self,
|
65
|
-
|
65
|
+
def set_app(self, app):
|
66
|
+
self._app = app
|
67
|
+
|
68
|
+
def get_app(self):
|
69
|
+
return self._app
|
70
|
+
|
71
|
+
@property
|
72
|
+
def app(self):
|
73
|
+
return self._app
|
74
|
+
|
75
|
+
# -------------------------------------------------------------------------
|
76
|
+
# Legacy / deprecated
|
77
|
+
# -------------------------------------------------------------------------
|
66
78
|
|
67
79
|
def get_config(self):
|
68
80
|
print("DEPRECATED: get_config() use property instead")
|
@@ -71,14 +83,6 @@ class AbstractWebApp:
|
|
71
83
|
def set_config(self, config):
|
72
84
|
print("DEPRECATED: set_config() use constructor instead")
|
73
85
|
|
74
|
-
def get_app(self):
|
75
|
-
print("DEPRECATED: get_app()")
|
76
|
-
return self
|
77
|
-
|
78
|
-
@property
|
79
|
-
def app(self):
|
80
|
-
print("DEPRECATED: .app.")
|
81
|
-
|
82
86
|
def get_last_active_client_id(self):
|
83
87
|
print(
|
84
88
|
"DEPRECATED: get_last_active_client_id() should be replaced by last_active_client_id"
|
@@ -132,6 +136,7 @@ class WslinkHandler(object):
|
|
132
136
|
self.connections = {}
|
133
137
|
self.authentified_client_ids = set()
|
134
138
|
self.attachment_atomic = asyncio.Lock()
|
139
|
+
self.pub_manager = PublishManager()
|
135
140
|
|
136
141
|
# Build the rpc method dictionary, assuming we were given a serverprotocol
|
137
142
|
if self.getServerProtocol():
|
@@ -161,7 +166,7 @@ class WslinkHandler(object):
|
|
161
166
|
|
162
167
|
@property
|
163
168
|
def publishManager(self):
|
164
|
-
return
|
169
|
+
return self.pub_manager
|
165
170
|
|
166
171
|
@property
|
167
172
|
def reverse_connection_client_id(self):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: wslink
|
3
|
-
Version: 1.11.
|
3
|
+
Version: 1.11.2
|
4
4
|
Summary: Python/JavaScript library for communicating over WebSocket
|
5
5
|
Home-page: https://github.com/kitware/wslink
|
6
6
|
Author: Kitware, Inc.
|
@@ -21,7 +21,7 @@ Classifier: Programming Language :: Python :: 3.7
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.8
|
22
22
|
Classifier: Programming Language :: Python :: 3.9
|
23
23
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
24
|
-
Requires-Dist: aiohttp
|
24
|
+
Requires-Dist: aiohttp <4
|
25
25
|
Provides-Extra: ssl
|
26
26
|
Requires-Dist: cryptography ; extra == 'ssl'
|
27
27
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
wslink/LICENSE,sha256=I44UH7kDVqxDLnnlOWw_hFL2Fz7RjQ_4vPzZv9NYgTU,1483
|
2
2
|
wslink/__init__.py,sha256=AbEm-sUSoGL-uLpnbK1rSSjHSvyW-bMsGHWie7FgMHw,2708
|
3
3
|
wslink/launcher.py,sha256=4l_z3l2xkRSiH8hWbZzjtsIbBeujl-P8bTA0TBtJEEg,21137
|
4
|
-
wslink/protocol.py,sha256=
|
4
|
+
wslink/protocol.py,sha256=acKNj_J4AdFKpIUz-6eA9MLcjucy_xGhs2WLHvu_Gc4,17962
|
5
5
|
wslink/publish.py,sha256=rSPG-GSVv4HawLXnKm9yceLadHx92EPR9XnGeSuOGlc,2573
|
6
6
|
wslink/relay.py,sha256=E8Lzu2Ay7KbOheN1-ArAZawo8lLqdDgJXOZSBuMknYs,86
|
7
7
|
wslink/server.py,sha256=FKSJAKHDyfkNVM45-M-y1Zn8hh2TTYto1hTCIJx1pp8,9440
|
@@ -9,14 +9,14 @@ wslink/ssl_context.py,sha256=hNOJJCdrStws1Qf6vPvY4vTk9Bf8J5d90W3fS0cRv8o,2290
|
|
9
9
|
wslink/uri.py,sha256=woCQ4yChUqTMg9IT6YYDtUYeKmCg7OUCEgeBGA-19DY,384
|
10
10
|
wslink/websocket.py,sha256=REYYyKB4WweMuDruvPBA0oPOfhddPF9G5WIGiK367KA,4574
|
11
11
|
wslink/backends/__init__.py,sha256=P29TsplrxWTWoA53gXO1Ik1YKNHnMxYDA98yJPn8km4,971
|
12
|
-
wslink/backends/aiohttp/__init__.py,sha256=
|
12
|
+
wslink/backends/aiohttp/__init__.py,sha256=FUPMwi0Z1nuVVIJhY_sI0ZzRY5ne30tmUILi7JQTgP4,8433
|
13
13
|
wslink/backends/aiohttp/launcher.py,sha256=Itblr2-lX_ZpAInvLlGkl1_XrNYjIn3w469BDZ5XyyQ,8737
|
14
14
|
wslink/backends/aiohttp/relay.py,sha256=Nn1ELqGU1kwvst4DNwNqYWU4nYd08K3STAMQIhcangY,13338
|
15
15
|
wslink/backends/generic/__init__.py,sha256=Qu65gWsd2xCSsxybnDtEDI5vMjHN-F5jgPZOyNIxnGs,112
|
16
|
-
wslink/backends/generic/core.py,sha256=
|
16
|
+
wslink/backends/generic/core.py,sha256=2BJrdCEyMe3OmT_h-wLeyw7QzpVTnm4O8zSkJmnDKyM,4003
|
17
17
|
wslink/backends/tornado/__init__.py,sha256=Qu65gWsd2xCSsxybnDtEDI5vMjHN-F5jgPZOyNIxnGs,112
|
18
18
|
wslink/backends/tornado/core.py,sha256=tPMkkhWuO_ovkisVim0zcegwZKEAG4IRUdd_O_0a_R0,2157
|
19
|
-
wslink-1.11.
|
20
|
-
wslink-1.11.
|
21
|
-
wslink-1.11.
|
22
|
-
wslink-1.11.
|
19
|
+
wslink-1.11.2.dist-info/METADATA,sha256=mHgRzEOs6-Tm_OUe6mZM-u14GR-ErWIR_anG5XJOLKs,3016
|
20
|
+
wslink-1.11.2.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
21
|
+
wslink-1.11.2.dist-info/top_level.txt,sha256=N0d8eqvhwhfW1p1yPTmvxlbzhjz7ZyhBfysNvaFqpQY,7
|
22
|
+
wslink-1.11.2.dist-info/RECORD,,
|
File without changes
|