lightstreamer-client-lib 2.2.1__tar.gz → 2.2.3__tar.gz
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.
- {lightstreamer_client_lib-2.2.1 → lightstreamer_client_lib-2.2.3}/PKG-INFO +8 -7
- {lightstreamer_client_lib-2.2.1 → lightstreamer_client_lib-2.2.3}/README.md +5 -5
- {lightstreamer_client_lib-2.2.1 → lightstreamer_client_lib-2.2.3}/pyproject.toml +1 -1
- {lightstreamer_client_lib-2.2.1 → lightstreamer_client_lib-2.2.3}/src/lightstreamer/client/com_lightstreamer_net.py +3 -3
- {lightstreamer_client_lib-2.2.1 → lightstreamer_client_lib-2.2.3}/src/lightstreamer/client/ls_python_client_api.py +15 -0
- {lightstreamer_client_lib-2.2.1 → lightstreamer_client_lib-2.2.3}/src/lightstreamer/client/ls_python_client_haxe.py +315 -28
- {lightstreamer_client_lib-2.2.1 → lightstreamer_client_lib-2.2.3}/src/lightstreamer/client/ls_python_client_wrapper.py +15 -0
- {lightstreamer_client_lib-2.2.1 → lightstreamer_client_lib-2.2.3}/src/lightstreamer_client_lib.egg-info/PKG-INFO +8 -7
- {lightstreamer_client_lib-2.2.1 → lightstreamer_client_lib-2.2.3}/LICENSE +0 -0
- {lightstreamer_client_lib-2.2.1 → lightstreamer_client_lib-2.2.3}/setup.cfg +0 -0
- {lightstreamer_client_lib-2.2.1 → lightstreamer_client_lib-2.2.3}/setup.py +0 -0
- {lightstreamer_client_lib-2.2.1 → lightstreamer_client_lib-2.2.3}/src/lightstreamer/client/__init__.py +0 -0
- {lightstreamer_client_lib-2.2.1 → lightstreamer_client_lib-2.2.3}/src/lightstreamer_client_lib.egg-info/SOURCES.txt +0 -0
- {lightstreamer_client_lib-2.2.1 → lightstreamer_client_lib-2.2.3}/src/lightstreamer_client_lib.egg-info/dependency_links.txt +0 -0
- {lightstreamer_client_lib-2.2.1 → lightstreamer_client_lib-2.2.3}/src/lightstreamer_client_lib.egg-info/requires.txt +0 -0
- {lightstreamer_client_lib-2.2.1 → lightstreamer_client_lib-2.2.3}/src/lightstreamer_client_lib.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: lightstreamer-client-lib
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.3
|
|
4
4
|
Summary: Lightstreamer Client SDK
|
|
5
5
|
Author-email: Lightstreamer Srl <support@lightstreamer.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -15,6 +15,7 @@ Description-Content-Type: text/markdown
|
|
|
15
15
|
License-File: LICENSE
|
|
16
16
|
Requires-Dist: aiohttp>=3.8.6
|
|
17
17
|
Requires-Dist: jsonpatch>=1.33
|
|
18
|
+
Dynamic: license-file
|
|
18
19
|
|
|
19
20
|
# Lightstreamer Python Client SDK
|
|
20
21
|
|
|
@@ -34,7 +35,7 @@ The sdk is supported on Python 3.7 and above.
|
|
|
34
35
|
|
|
35
36
|
## Quickstart
|
|
36
37
|
|
|
37
|
-
To connect to a Lightstreamer Server, a [LightstreamerClient](https://lightstreamer.com/api/ls-python-client/2.2.
|
|
38
|
+
To connect to a Lightstreamer Server, a [LightstreamerClient](https://lightstreamer.com/api/ls-python-client/2.2.3/lightstreamer.html#lightstreamer.client.ls_python_client_wrapper.LightstreamerClient) object has to be created, configured, and instructed to connect to the Lightstreamer Server.
|
|
38
39
|
A minimal version of the code that creates a LightstreamerClient and connects to the Lightstreamer Server on *https://push.lightstreamer.com* will look like this:
|
|
39
40
|
|
|
40
41
|
```python
|
|
@@ -44,7 +45,7 @@ client = LightstreamerClient("http://push.lightstreamer.com/","DEMO")
|
|
|
44
45
|
client.connect()
|
|
45
46
|
```
|
|
46
47
|
|
|
47
|
-
For each subscription to be subscribed to a Lightstreamer Server a [Subscription](https://lightstreamer.com/api/ls-python-client/2.2.
|
|
48
|
+
For each subscription to be subscribed to a Lightstreamer Server a [Subscription](https://lightstreamer.com/api/ls-python-client/2.2.3/lightstreamer.html#lightstreamer.client.ls_python_client_wrapper.Subscription) instance is needed.
|
|
48
49
|
A simple Subscription containing three items and two fields to be subscribed in *MERGE* mode is easily created (see [Lightstreamer General Concepts](https://lightstreamer.com/docs/ls-server/latest/General%20Concepts.pdf)):
|
|
49
50
|
|
|
50
51
|
```python
|
|
@@ -54,7 +55,7 @@ sub.setRequestedSnapshot("yes")
|
|
|
54
55
|
client.subscribe(sub)
|
|
55
56
|
```
|
|
56
57
|
|
|
57
|
-
Before sending the subscription to the server, usually at least one [SubscriptionListener](https://lightstreamer.com/api/ls-python-client/2.2.
|
|
58
|
+
Before sending the subscription to the server, usually at least one [SubscriptionListener](https://lightstreamer.com/api/ls-python-client/2.2.3/lightstreamer.html#lightstreamer.client.ls_python_client_api.SubscriptionListener) is attached to the Subscription instance in order to consume the real-time updates. The following code shows the values of the fields *stock_name* and *last_price* each time a new update is received for the subscription:
|
|
58
59
|
|
|
59
60
|
```python
|
|
60
61
|
class SubListener(SubscriptionListener):
|
|
@@ -88,7 +89,7 @@ client.connect()
|
|
|
88
89
|
|
|
89
90
|
## Logging
|
|
90
91
|
|
|
91
|
-
To enable the internal client logger, create a [LoggerProvider](https://lightstreamer.com/api/ls-python-client/2.2.
|
|
92
|
+
To enable the internal client logger, create a [LoggerProvider](https://lightstreamer.com/api/ls-python-client/2.2.3/lightstreamer.html#lightstreamer.client.ls_python_client_api.LoggerProvider) and set it as the default provider of [LightstreamerClient](https://lightstreamer.com/api/ls-python-client/2.2.3/lightstreamer.html#lightstreamer.client.ls_python_client_wrapper.LightstreamerClient.setLoggerProvider).
|
|
92
93
|
|
|
93
94
|
```python
|
|
94
95
|
import sys, logging
|
|
@@ -107,7 +108,7 @@ Compatible with Lightstreamer Server since version 7.4.0.
|
|
|
107
108
|
|
|
108
109
|
- [Live demos](https://demos.lightstreamer.com/?p=lightstreamer&t=client&lclient=python)
|
|
109
110
|
|
|
110
|
-
- [API Reference](https://lightstreamer.com/api/ls-python-client/2.2.
|
|
111
|
+
- [API Reference](https://lightstreamer.com/api/ls-python-client/2.2.3/index.html)
|
|
111
112
|
|
|
112
113
|
## Support
|
|
113
114
|
|
|
@@ -16,7 +16,7 @@ The sdk is supported on Python 3.7 and above.
|
|
|
16
16
|
|
|
17
17
|
## Quickstart
|
|
18
18
|
|
|
19
|
-
To connect to a Lightstreamer Server, a [LightstreamerClient](https://lightstreamer.com/api/ls-python-client/2.2.
|
|
19
|
+
To connect to a Lightstreamer Server, a [LightstreamerClient](https://lightstreamer.com/api/ls-python-client/2.2.3/lightstreamer.html#lightstreamer.client.ls_python_client_wrapper.LightstreamerClient) object has to be created, configured, and instructed to connect to the Lightstreamer Server.
|
|
20
20
|
A minimal version of the code that creates a LightstreamerClient and connects to the Lightstreamer Server on *https://push.lightstreamer.com* will look like this:
|
|
21
21
|
|
|
22
22
|
```python
|
|
@@ -26,7 +26,7 @@ client = LightstreamerClient("http://push.lightstreamer.com/","DEMO")
|
|
|
26
26
|
client.connect()
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
For each subscription to be subscribed to a Lightstreamer Server a [Subscription](https://lightstreamer.com/api/ls-python-client/2.2.
|
|
29
|
+
For each subscription to be subscribed to a Lightstreamer Server a [Subscription](https://lightstreamer.com/api/ls-python-client/2.2.3/lightstreamer.html#lightstreamer.client.ls_python_client_wrapper.Subscription) instance is needed.
|
|
30
30
|
A simple Subscription containing three items and two fields to be subscribed in *MERGE* mode is easily created (see [Lightstreamer General Concepts](https://lightstreamer.com/docs/ls-server/latest/General%20Concepts.pdf)):
|
|
31
31
|
|
|
32
32
|
```python
|
|
@@ -36,7 +36,7 @@ sub.setRequestedSnapshot("yes")
|
|
|
36
36
|
client.subscribe(sub)
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
Before sending the subscription to the server, usually at least one [SubscriptionListener](https://lightstreamer.com/api/ls-python-client/2.2.
|
|
39
|
+
Before sending the subscription to the server, usually at least one [SubscriptionListener](https://lightstreamer.com/api/ls-python-client/2.2.3/lightstreamer.html#lightstreamer.client.ls_python_client_api.SubscriptionListener) is attached to the Subscription instance in order to consume the real-time updates. The following code shows the values of the fields *stock_name* and *last_price* each time a new update is received for the subscription:
|
|
40
40
|
|
|
41
41
|
```python
|
|
42
42
|
class SubListener(SubscriptionListener):
|
|
@@ -70,7 +70,7 @@ client.connect()
|
|
|
70
70
|
|
|
71
71
|
## Logging
|
|
72
72
|
|
|
73
|
-
To enable the internal client logger, create a [LoggerProvider](https://lightstreamer.com/api/ls-python-client/2.2.
|
|
73
|
+
To enable the internal client logger, create a [LoggerProvider](https://lightstreamer.com/api/ls-python-client/2.2.3/lightstreamer.html#lightstreamer.client.ls_python_client_api.LoggerProvider) and set it as the default provider of [LightstreamerClient](https://lightstreamer.com/api/ls-python-client/2.2.3/lightstreamer.html#lightstreamer.client.ls_python_client_wrapper.LightstreamerClient.setLoggerProvider).
|
|
74
74
|
|
|
75
75
|
```python
|
|
76
76
|
import sys, logging
|
|
@@ -89,7 +89,7 @@ Compatible with Lightstreamer Server since version 7.4.0.
|
|
|
89
89
|
|
|
90
90
|
- [Live demos](https://demos.lightstreamer.com/?p=lightstreamer&t=client&lclient=python)
|
|
91
91
|
|
|
92
|
-
- [API Reference](https://lightstreamer.com/api/ls-python-client/2.2.
|
|
92
|
+
- [API Reference](https://lightstreamer.com/api/ls-python-client/2.2.3/index.html)
|
|
93
93
|
|
|
94
94
|
## Support
|
|
95
95
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "lightstreamer-client-lib"
|
|
7
|
-
version = "2.2.
|
|
7
|
+
version = "2.2.3"
|
|
8
8
|
description = "Lightstreamer Client SDK"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [{ name = "Lightstreamer Srl", email = "support@lightstreamer.com" }]
|
|
@@ -94,7 +94,7 @@ class HttpClientPy:
|
|
|
94
94
|
proxy_url, proxy_auth = build_proxy(proxy)
|
|
95
95
|
try:
|
|
96
96
|
session = SessionPy.getInstance()
|
|
97
|
-
async with session.request("POST", url, data=body, headers=headers, proxy=proxy_url, proxy_auth=proxy_auth, ssl=sslContext) as resp:
|
|
97
|
+
async with session.request("POST", url, data=body, headers=headers, proxy=proxy_url, proxy_auth=proxy_auth, ssl=(True if sslContext is None else sslContext)) as resp:
|
|
98
98
|
self.cancellationToken.set_result(resp)
|
|
99
99
|
if not resp.ok:
|
|
100
100
|
raise Exception("Unexpected HTTP code: " + str(resp.status))
|
|
@@ -141,7 +141,7 @@ class WsClientPy:
|
|
|
141
141
|
proxy_url, proxy_auth = build_proxy(proxy)
|
|
142
142
|
try:
|
|
143
143
|
session = SessionPy.getInstance()
|
|
144
|
-
async with session.ws_connect(url, protocols=(protocol,), headers=headers, proxy=proxy_url, proxy_auth=proxy_auth, ssl=sslContext) as ws:
|
|
144
|
+
async with session.ws_connect(url, protocols=(protocol,), headers=headers, proxy=proxy_url, proxy_auth=proxy_auth, ssl=(True if sslContext is None else sslContext)) as ws:
|
|
145
145
|
self.cancellationToken.set_result(ws)
|
|
146
146
|
self.ws = ws
|
|
147
147
|
self.on_open(self)
|
|
@@ -166,7 +166,7 @@ class WsClientPy:
|
|
|
166
166
|
resp = self.cancellationToken.result()
|
|
167
167
|
ls_io_thread.submit_coro(resp.close())
|
|
168
168
|
else:
|
|
169
|
-
|
|
169
|
+
def on_done_callback(future):
|
|
170
170
|
resp = future.result()
|
|
171
171
|
ls_io_thread.submit_coro(resp.close())
|
|
172
172
|
self.cancellationToken.add_done_callback(on_done_callback)
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# Copyright (C) 2023 Lightstreamer Srl
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
1
14
|
class ClientListener:
|
|
2
15
|
"""Interface to be implemented to listen to :class:`.LightstreamerClient` events comprehending notifications of
|
|
3
16
|
connection activity and errors.
|
|
@@ -185,6 +198,8 @@ class ClientMessageListener:
|
|
|
185
198
|
|
|
186
199
|
:param originalMessage: the message to which this notification is related.
|
|
187
200
|
:param sentOnNetwork: true if the message was sent on the network, false otherwise. Even if the flag is true, it is not possible to infer whether the message actually reached the Lightstreamer Server or not.
|
|
201
|
+
|
|
202
|
+
.. seealso:: `Client-to-Server Messaging in Lightstreamer Explained — Aborted messages <https://lightstreamer.com/blog/client-to-server-messaging-in-lightstreamer-explained/#Aborted_messages>`_
|
|
188
203
|
"""
|
|
189
204
|
pass
|
|
190
205
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Generated by Haxe 4.3.
|
|
1
|
+
# Generated by Haxe 4.3.7
|
|
2
2
|
# coding: utf-8
|
|
3
3
|
import sys
|
|
4
4
|
|
|
@@ -521,9 +521,9 @@ Type._hx_class = Type
|
|
|
521
521
|
class LSConnectionDetails:
|
|
522
522
|
_hx_class_name = "LSConnectionDetails"
|
|
523
523
|
_hx_is_interface = "False"
|
|
524
|
-
__slots__ = ("serverAddress", "adapterSet", "user", "password", "sessionId", "serverInstanceAddress", "serverSocketName", "clientIp", "client", "lock")
|
|
525
|
-
_hx_fields = ["serverAddress", "adapterSet", "user", "password", "sessionId", "serverInstanceAddress", "serverSocketName", "clientIp", "client", "lock"]
|
|
526
|
-
_hx_methods = ["getServerAddress", "setServerAddress", "getAdapterSet", "setAdapterSet", "getUser", "setUser", "setPassword", "getSessionId", "setSessionId", "getServerInstanceAddress", "setServerInstanceAddress", "getServerSocketName", "setServerSocketName", "getClientIp", "setClientIp", "toString"]
|
|
524
|
+
__slots__ = ("serverAddress", "adapterSet", "user", "password", "sessionId", "serverInstanceAddress", "serverSocketName", "clientIp", "certificatePins", "client", "lock")
|
|
525
|
+
_hx_fields = ["serverAddress", "adapterSet", "user", "password", "sessionId", "serverInstanceAddress", "serverSocketName", "clientIp", "certificatePins", "client", "lock"]
|
|
526
|
+
_hx_methods = ["getServerAddress", "setServerAddress", "arrayEqual", "getCertificatePins_Native", "setCertificatePins_Native", "getCertificatePins", "setCertificatePins", "getAdapterSet", "setAdapterSet", "getUser", "setUser", "setPassword", "getSessionId", "setSessionId", "getServerInstanceAddress", "setServerInstanceAddress", "getServerSocketName", "setServerSocketName", "getClientIp", "setClientIp", "toString"]
|
|
527
527
|
|
|
528
528
|
def __init__(self,client):
|
|
529
529
|
self.clientIp = None
|
|
@@ -533,6 +533,7 @@ class LSConnectionDetails:
|
|
|
533
533
|
self.password = None
|
|
534
534
|
self.user = None
|
|
535
535
|
self.adapterSet = None
|
|
536
|
+
self.certificatePins = []
|
|
536
537
|
self.serverAddress = com_lightstreamer_client__ConnectionDetails_ConnectionDetails_Fields_.DEFAULT_SERVER
|
|
537
538
|
self.client = client
|
|
538
539
|
self.lock = client.lock
|
|
@@ -560,6 +561,69 @@ class LSConnectionDetails:
|
|
|
560
561
|
_gthis.client.machine.evtServerAddressChanged()
|
|
561
562
|
self.lock.synchronized(_hx_local_0)
|
|
562
563
|
|
|
564
|
+
def arrayEqual(self,a,b):
|
|
565
|
+
if (len(a) != len(b)):
|
|
566
|
+
return False
|
|
567
|
+
_g = 0
|
|
568
|
+
_g1 = len(a)
|
|
569
|
+
while (_g < _g1):
|
|
570
|
+
i = _g
|
|
571
|
+
_g = (_g + 1)
|
|
572
|
+
if ((a[i] if i >= 0 and i < len(a) else None) != (b[i] if i >= 0 and i < len(b) else None)):
|
|
573
|
+
return False
|
|
574
|
+
return True
|
|
575
|
+
|
|
576
|
+
def getCertificatePins_Native(self):
|
|
577
|
+
_gthis = self
|
|
578
|
+
def _hx_local_1():
|
|
579
|
+
def _hx_local_0():
|
|
580
|
+
return list(_gthis.getCertificatePins())
|
|
581
|
+
return self.lock.synchronized(_hx_local_0)
|
|
582
|
+
return _hx_local_1()
|
|
583
|
+
|
|
584
|
+
def setCertificatePins_Native(self,pins):
|
|
585
|
+
_gthis = self
|
|
586
|
+
def _hx_local_0():
|
|
587
|
+
if (pins is None):
|
|
588
|
+
raise com_lightstreamer_internal_IllegalArgumentException("Pins list cannot be null")
|
|
589
|
+
_gthis.setCertificatePins(list(pins))
|
|
590
|
+
self.lock.synchronized(_hx_local_0)
|
|
591
|
+
|
|
592
|
+
def getCertificatePins(self):
|
|
593
|
+
_gthis = self
|
|
594
|
+
def _hx_local_1():
|
|
595
|
+
def _hx_local_0():
|
|
596
|
+
return list(_gthis.certificatePins)
|
|
597
|
+
return self.lock.synchronized(_hx_local_0)
|
|
598
|
+
return _hx_local_1()
|
|
599
|
+
|
|
600
|
+
def setCertificatePins(self,pins):
|
|
601
|
+
_gthis = self
|
|
602
|
+
def _hx_local_1():
|
|
603
|
+
if _gthis.arrayEqual(pins,_gthis.certificatePins):
|
|
604
|
+
return
|
|
605
|
+
_g = 0
|
|
606
|
+
while (_g < len(pins)):
|
|
607
|
+
pin = (pins[_g] if _g >= 0 and _g < len(pins) else None)
|
|
608
|
+
_g = (_g + 1)
|
|
609
|
+
if pin.startswith("sha1/"):
|
|
610
|
+
try:
|
|
611
|
+
haxe_crypto_Base64.decode(HxString.substring(pin,len("sha1/"),None))
|
|
612
|
+
except BaseException as _g1:
|
|
613
|
+
raise com_lightstreamer_internal_IllegalArgumentException(("Invalid pin hash: " + ("null" if pin is None else pin)))
|
|
614
|
+
elif pin.startswith("sha256/"):
|
|
615
|
+
try:
|
|
616
|
+
haxe_crypto_Base64.decode(HxString.substring(pin,len("sha256/"),None))
|
|
617
|
+
except BaseException as _g2:
|
|
618
|
+
raise com_lightstreamer_internal_IllegalArgumentException(("Invalid pin hash: " + ("null" if pin is None else pin)))
|
|
619
|
+
else:
|
|
620
|
+
raise com_lightstreamer_internal_IllegalArgumentException(("Pins must start with \"sha256/\" or \"sha1/\": " + ("null" if pin is None else pin)))
|
|
621
|
+
if com_lightstreamer_log__LoggerTools_LoggerTools_Fields_.actionLogger.isInfoEnabled():
|
|
622
|
+
com_lightstreamer_log__LoggerTools_LoggerTools_Fields_.actionLogger.info(("certificatePins changed: " + Std.string(pins)))
|
|
623
|
+
_gthis.certificatePins = list(pins)
|
|
624
|
+
_gthis.client.eventDispatcher.onPropertyChange("certificatePins")
|
|
625
|
+
self.lock.synchronized(_hx_local_1)
|
|
626
|
+
|
|
563
627
|
def getAdapterSet(self):
|
|
564
628
|
_gthis = self
|
|
565
629
|
def _hx_local_1():
|
|
@@ -2442,7 +2506,7 @@ class com_lightstreamer_client_internal_ClientMachine:
|
|
|
2442
2506
|
_hx_is_interface = "False"
|
|
2443
2507
|
__slots__ = ("client", "details", "options", "lock", "clientEventDispatcher", "state", "wsFactory", "httpFactory", "ctrlFactory", "timerFactory", "randomGenerator", "delayCounter", "m_status", "m_nextReqId", "m_nextSubId", "defaultServerAddress", "requestLimit", "keepaliveInterval", "idleTimeout", "sessionId", "serverInstanceAddress", "lastKnownClientIp", "cause", "connectTs", "recoverTs", "ctrl_connectTs", "suspendedTransports", "disabledTransports", "sequenceMap", "messageManagers", "subscriptionManagers", "switchRequest", "constrainRequest", "swt_lastReqId", "rhb_grantedInterval", "rhb_currentInterval", "bw_requestedMaxBandwidth", "bw_lastReqId", "reachabilityFactory", "nr_reachabilityManager", "frz_pageLifecycleFactory", "frz_pageLifecycle", "rec_serverProg", "rec_clientProg", "slw_refTime", "slw_avgDelayMs", "slw_maxAvgDelayMs", "slw_hugeDelayMs", "slw_m", "ws", "http", "ctrl_http", "transportTimer", "retryTimer", "keepaliveTimer", "stalledTimer", "reconnectTimer", "rhbTimer", "recoveryTimer", "idleTimer", "pollingTimer", "ctrlTimer")
|
|
2444
2508
|
_hx_fields = ["client", "details", "options", "lock", "clientEventDispatcher", "state", "wsFactory", "httpFactory", "ctrlFactory", "timerFactory", "randomGenerator", "delayCounter", "m_status", "m_nextReqId", "m_nextSubId", "defaultServerAddress", "requestLimit", "keepaliveInterval", "idleTimeout", "sessionId", "serverInstanceAddress", "lastKnownClientIp", "cause", "connectTs", "recoverTs", "ctrl_connectTs", "suspendedTransports", "disabledTransports", "sequenceMap", "messageManagers", "subscriptionManagers", "switchRequest", "constrainRequest", "swt_lastReqId", "rhb_grantedInterval", "rhb_currentInterval", "bw_requestedMaxBandwidth", "bw_lastReqId", "reachabilityFactory", "nr_reachabilityManager", "frz_pageLifecycleFactory", "frz_pageLifecycle", "rec_serverProg", "rec_clientProg", "slw_refTime", "slw_avgDelayMs", "slw_maxAvgDelayMs", "slw_hugeDelayMs", "slw_m", "ws", "http", "ctrl_http", "transportTimer", "retryTimer", "keepaliveTimer", "stalledTimer", "reconnectTimer", "rhbTimer", "recoveryTimer", "idleTimer", "pollingTimer", "ctrlTimer"]
|
|
2445
|
-
_hx_methods = ["disposeSession", "disposeClient", "evtExtConnect", "evtExtConnect_NextRegion", "evtExtConnect_NetworkReachabilityRegion", "doInstallPageLifecycle", "doUnistallPageLifecycle", "evtPageFrozen", "evtPageResumed", "evtNetworkNotReachable", "evtNetworkReachable", "evtOnlineAgain", "evtServerAddressChanged", "evtExtDisconnect", "evtSelectCreate", "evtWSOpen", "evtMessage", "evtCtrlMessage", "evtTransportTimeout", "evtTransportError", "evtIdleTimeout", "evtPollingTimeout", "evtKeepaliveTimeout", "evtStalledTimeout", "evtReconnectTimeout", "evtRestartKeepalive", "evtWSOK", "evtCONERR", "evtEND", "evtERROR", "evtREQOK_withoutReqId", "evtREQOK", "evtREQOK_Forward", "evtREQOK_TransportRegion", "evtREQERR", "evtREQERR_Forward", "evtREQERR_TransportRegion", "evtPROG", "evtLOOP", "evtCONOK", "evtSERVNAME", "evtCLIENTIP", "evtCONS", "evtPROBE", "evtNOOP", "evtSYNC", "evtSYNC_PushingRegion", "evtMSGDONE", "evtMSGFAIL", "evtU", "evtSUBOK", "evtSUBCMD", "evtUNSUB", "evtEOS", "evtCS", "evtOV", "evtCONF", "evtCheckAvg", "evtSendPendingControls", "evtSendPendingMessages", "evtSelectRhb", "evtExtSetReverseHeartbeatInterval", "evtRestartHeartbeat", "evtRhbTimeout", "evtDisposeCtrl", "evtStartRecovery", "evtRecoveryTimeout", "evtCheckRecoveryTimeout", "evtCreate", "evtCheckTransport", "evtCheckBW", "evtCheckCtrlRequests", "evtCtrlDone", "evtCtrlError", "evtCtrlTimeout", "evtSendControl", "evtSendHeartbeat", "evtStartSession", "evtEndSession", "evtRetry", "evtRetry_NextRegion", "evtTerminate", "evtTerminate_NextRegion", "evtTerminate_NetworkReachabilityRegion", "evtRetryTimeout", "evtExtSetForcedTransport", "evtExtSetRequestedMaxBandwidth", "evtForceSlowing", "evtForcePolling", "evtSendMessage", "evtSwitchTransport", "evtSwitchTransport_forwardToTransportRegion", "onFreshData", "onStaleData", "isFreshData", "openWS", "openWS_Create", "openWS_Bind", "sendCreateWS", "sendBindWS_Streaming", "sendBindWS_FirstPolling", "sendBindWS_Polling", "sendDestroyWS", "sendHttpRequest", "sendCreateHTTP", "sendBindHTTP_Streaming", "sendBindHTTP_Polling", "sendCreateTTL", "sendRecovery", "disposeWS", "closeWS", "suspendWS_Streaming", "disableWS", "disableHTTP_Streaming", "disableStreaming", "enableAllTransports", "disposeHTTP", "closeHTTP", "disposeCtrl", "closeCtrl", "notifyStatus", "getBestForCreating", "getBestForBinding", "resetCurrentRetryDelay", "notifyServerErrorIfCauseIsError", "notifyServerError_CONERR", "notifyServerError_END", "notifyServerError_ERROR", "notifyServerError_REQERR", "doCONOK", "doCONOK_CreateWS", "doCONOK_BindWS_Streaming", "doCONOK_BindWS_Polling", "doCONOK_CreateHTTP", "doCONOK_BindHTTP_Streaming", "doCONOK_BindHTTP_Polling", "doSERVNAME", "doCLIENTIP", "doCONS", "doLOOP", "doPROG", "doMSGDONE", "doMSGFAIL", "doU", "doSUBOK", "doSUBCMD", "doUNSUB", "doEOS", "doCS", "doOV", "doCONF", "doREQOK", "doREQERR", "doSYNC", "doSYNC_G", "doSYNC_NG", "diffTimeSync", "slowAvg", "schedule_evtTransportTimeout", "schedule_evtRetryTimeout", "schedule_evtRecoveryTimeout", "schedule_evtIdleTimeout", "schedule_evtPollingTimeout", "schedule_evtCtrlTimeout", "schedule_evtKeepaliveTimeout", "schedule_evtStalledTimeout", "schedule_evtReconnectTimeout", "schedule_evtRhbTimeout", "createTimer", "cancel_evtTransportTimeout", "cancel_evtRetryTimeout", "cancel_evtKeepaliveTimeout", "cancel_evtStalledTimeout", "cancel_evtReconnectTimeout", "cancel_evtRhbTimeout", "cancel_evtIdleTimeout", "cancel_evtPollingTimeout", "cancel_evtCtrlTimeout", "cancel_evtRecoveryTimeout", "waitingInterval", "exit_tr", "entry_m111", "entry_m112", "entry_m113", "entry_m115", "entry_rec", "exit_w", "exit_ws", "exit_wp", "exit_hs", "exit_hp", "exit_ctrl", "exit_rec", "exit_keepalive_unit", "exit_w_to_m", "exit_ws_to_m", "exit_wp_to_m", "exit_hs_to_m", "exit_hs_to_rec", "exit_hp_to_m", "exit_hp_to_rec", "exit_ctrl_to_m", "exit_rec_to_m", "randomPause", "generateFreshReqId", "generateFreshSubId", "genAbortSubscriptions", "genAckMessagesWS", "genAbortMessages", "resetSequenceMap", "isSwitching", "encodeSwitch", "encodeConstrain", "getPendingControls", "sendControlWS", "sendMsgWS", "sendPengingControlsWS", "sendPendingMessagesWS", "sendBatchWS", "sendHeartbeatWS", "sendPendingControlsHTTP", "sendPendingMessagesHTTP", "sendHeartbeatHTTP", "sendBatchHTTP", "prepareBatchWS", "prepareBatchHTTP", "getHeadersForRequestOtherThanCreate", "getServerAddress", "relateSubManager", "unrelateSubManager", "isRelatedWithSubManager", "relateMsgManager", "unrelateMsgManager", "getAndSetNextMsgProg", "onPropertyChange", "traceEvent", "connect", "disconnect", "getStatus", "sendMessage", "subscribeExt", "unsubscribe", "getSubscriptions"]
|
|
2509
|
+
_hx_methods = ["disposeSession", "disposeClient", "evtExtConnect", "evtExtConnect_NextRegion", "evtExtConnect_NetworkReachabilityRegion", "doInstallPageLifecycle", "doUnistallPageLifecycle", "evtPageFrozen", "evtPageResumed", "evtNetworkNotReachable", "evtNetworkReachable", "evtOnlineAgain", "evtServerAddressChanged", "evtExtDisconnect", "evtSelectCreate", "evtWSOpen", "evtMessage", "evtCtrlMessage", "evtTransportTimeout", "evtTransportFatalError", "evtTransportError", "evtIdleTimeout", "evtPollingTimeout", "evtKeepaliveTimeout", "evtStalledTimeout", "evtReconnectTimeout", "evtRestartKeepalive", "evtWSOK", "evtCONERR", "evtEND", "evtERROR", "evtREQOK_withoutReqId", "evtREQOK", "evtREQOK_Forward", "evtREQOK_TransportRegion", "evtREQERR", "evtREQERR_Forward", "evtREQERR_TransportRegion", "evtPROG", "evtLOOP", "evtCONOK", "evtSERVNAME", "evtCLIENTIP", "evtCONS", "evtPROBE", "evtNOOP", "evtSYNC", "evtSYNC_PushingRegion", "evtMSGDONE", "evtMSGFAIL", "evtU", "evtSUBOK", "evtSUBCMD", "evtUNSUB", "evtEOS", "evtCS", "evtOV", "evtCONF", "evtCheckAvg", "evtSendPendingControls", "evtSendPendingMessages", "evtSelectRhb", "evtExtSetReverseHeartbeatInterval", "evtRestartHeartbeat", "evtRhbTimeout", "evtDisposeCtrl", "evtStartRecovery", "evtRecoveryTimeout", "evtCheckRecoveryTimeout", "evtCreate", "evtCheckTransport", "evtCheckBW", "evtCheckCtrlRequests", "evtCtrlDone", "evtCtrlFatalError", "evtCtrlError", "evtCtrlTimeout", "evtSendControl", "evtSendHeartbeat", "evtStartSession", "evtEndSession", "evtRetry", "evtRetry_NextRegion", "evtTerminate", "evtTerminate_NextRegion", "evtTerminate_NetworkReachabilityRegion", "evtRetryTimeout", "evtExtSetForcedTransport", "evtExtSetRequestedMaxBandwidth", "evtForceSlowing", "evtForcePolling", "evtSendMessage", "evtSwitchTransport", "evtSwitchTransport_forwardToTransportRegion", "onFreshData", "onStaleData", "isFreshData", "openWS", "openWS_Create", "openWS_Bind", "sendCreateWS", "sendBindWS_Streaming", "sendBindWS_FirstPolling", "sendBindWS_Polling", "sendDestroyWS", "sendHttpRequest", "sendCreateHTTP", "sendBindHTTP_Streaming", "sendBindHTTP_Polling", "sendCreateTTL", "sendRecovery", "disposeWS", "closeWS", "suspendWS_Streaming", "disableWS", "disableHTTP_Streaming", "disableStreaming", "enableAllTransports", "disposeHTTP", "closeHTTP", "disposeCtrl", "closeCtrl", "notifyStatus", "getBestForCreating", "getBestForBinding", "resetCurrentRetryDelay", "notifyServerErrorIfCauseIsError", "notifyServerError_CONERR", "notifyServerError_END", "notifyServerError_ERROR", "notifyServerError_REQERR", "doCONOK", "doCONOK_CreateWS", "doCONOK_BindWS_Streaming", "doCONOK_BindWS_Polling", "doCONOK_CreateHTTP", "doCONOK_BindHTTP_Streaming", "doCONOK_BindHTTP_Polling", "doSERVNAME", "doCLIENTIP", "doCONS", "doLOOP", "doPROG", "doMSGDONE", "doMSGFAIL", "doU", "doSUBOK", "doSUBCMD", "doUNSUB", "doEOS", "doCS", "doOV", "doCONF", "doREQOK", "doREQERR", "doSYNC", "doSYNC_G", "doSYNC_NG", "diffTimeSync", "slowAvg", "schedule_evtTransportTimeout", "schedule_evtRetryTimeout", "schedule_evtRecoveryTimeout", "schedule_evtIdleTimeout", "schedule_evtPollingTimeout", "schedule_evtCtrlTimeout", "schedule_evtKeepaliveTimeout", "schedule_evtStalledTimeout", "schedule_evtReconnectTimeout", "schedule_evtRhbTimeout", "createTimer", "cancel_evtTransportTimeout", "cancel_evtRetryTimeout", "cancel_evtKeepaliveTimeout", "cancel_evtStalledTimeout", "cancel_evtReconnectTimeout", "cancel_evtRhbTimeout", "cancel_evtIdleTimeout", "cancel_evtPollingTimeout", "cancel_evtCtrlTimeout", "cancel_evtRecoveryTimeout", "waitingInterval", "exit_tr", "entry_m111", "entry_m112", "entry_m113", "entry_m115", "entry_rec", "exit_w", "exit_ws", "exit_wp", "exit_hs", "exit_hp", "exit_ctrl", "exit_rec", "exit_keepalive_unit", "exit_w_to_m", "exit_ws_to_m", "exit_wp_to_m", "exit_hs_to_m", "exit_hs_to_rec", "exit_hp_to_m", "exit_hp_to_rec", "exit_ctrl_to_m", "exit_rec_to_m", "randomPause", "generateFreshReqId", "generateFreshSubId", "genAbortSubscriptions", "genAckMessagesWS", "genAbortMessages", "resetSequenceMap", "isSwitching", "encodeSwitch", "encodeConstrain", "getPendingControls", "sendControlWS", "sendMsgWS", "sendPengingControlsWS", "sendPendingMessagesWS", "sendBatchWS", "sendHeartbeatWS", "sendPendingControlsHTTP", "sendPendingMessagesHTTP", "sendHeartbeatHTTP", "sendBatchHTTP", "prepareBatchWS", "prepareBatchHTTP", "getHeadersForRequestOtherThanCreate", "getServerAddress", "relateSubManager", "unrelateSubManager", "isRelatedWithSubManager", "relateMsgManager", "unrelateMsgManager", "getAndSetNextMsgProg", "onPropertyChange", "traceEvent", "connect", "disconnect", "getStatus", "sendMessage", "subscribeExt", "unsubscribe", "getSubscriptions"]
|
|
2446
2510
|
_hx_statics = ["frz_globalPageLifecycle"]
|
|
2447
2511
|
|
|
2448
2512
|
def __init__(self,client,factory):
|
|
@@ -2931,7 +2995,7 @@ class com_lightstreamer_client_internal_ClientMachine:
|
|
|
2931
2995
|
_gthis.notifyStatus("DISCONNECTED")
|
|
2932
2996
|
_gthis.notifyServerErrorIfCauseIsError(terminationCause)
|
|
2933
2997
|
_gthis.state.goto_m_from_wp(100)
|
|
2934
|
-
_gthis.
|
|
2998
|
+
_gthis.exit_wp_to_m()
|
|
2935
2999
|
_gthis.evtTerminate(terminationCause)
|
|
2936
3000
|
else:
|
|
2937
3001
|
tmp = _gthis.state.s_wp
|
|
@@ -3314,6 +3378,103 @@ class com_lightstreamer_client_internal_ClientMachine:
|
|
|
3314
3378
|
else:
|
|
3315
3379
|
pass
|
|
3316
3380
|
|
|
3381
|
+
def evtTransportFatalError(self,errCode,errMsg):
|
|
3382
|
+
self.traceEvent("transport.fatal.error")
|
|
3383
|
+
terminationCause = com_lightstreamer_client_internal__ClientMachine_TerminationCause.TC_standardError(errCode,errMsg)
|
|
3384
|
+
_g = self.state.s_m
|
|
3385
|
+
if (((_g == 122) or ((_g == 121))) or ((_g == 120))):
|
|
3386
|
+
self.disposeWS()
|
|
3387
|
+
self.notifyStatus("DISCONNECTED")
|
|
3388
|
+
self.notifyServerErrorIfCauseIsError(terminationCause)
|
|
3389
|
+
self.state.s_m = 100
|
|
3390
|
+
self.state.traceState()
|
|
3391
|
+
self.cancel_evtTransportTimeout()
|
|
3392
|
+
self.evtTerminate(terminationCause)
|
|
3393
|
+
elif (_g == 130):
|
|
3394
|
+
self.disposeHTTP()
|
|
3395
|
+
self.notifyStatus("DISCONNECTED")
|
|
3396
|
+
self.notifyServerErrorIfCauseIsError(terminationCause)
|
|
3397
|
+
self.state.s_m = 100
|
|
3398
|
+
self.state.traceState()
|
|
3399
|
+
self.cancel_evtTransportTimeout()
|
|
3400
|
+
self.evtTerminate(terminationCause)
|
|
3401
|
+
elif (_g == 140):
|
|
3402
|
+
self.disposeHTTP()
|
|
3403
|
+
self.notifyStatus("DISCONNECTED")
|
|
3404
|
+
self.notifyServerErrorIfCauseIsError(terminationCause)
|
|
3405
|
+
self.state.s_m = 100
|
|
3406
|
+
self.state.traceState()
|
|
3407
|
+
self.cancel_evtTransportTimeout()
|
|
3408
|
+
self.evtTerminate(terminationCause)
|
|
3409
|
+
elif (_g == 150):
|
|
3410
|
+
_g = self.state.s_tr
|
|
3411
|
+
if (_g is not None):
|
|
3412
|
+
if (_g == 210):
|
|
3413
|
+
self.disposeWS()
|
|
3414
|
+
self.notifyStatus("DISCONNECTED")
|
|
3415
|
+
self.notifyServerErrorIfCauseIsError(terminationCause)
|
|
3416
|
+
self.state.clear_w()
|
|
3417
|
+
self.state.goto_m_from_session(100)
|
|
3418
|
+
self.exit_w()
|
|
3419
|
+
self.evtEndSession()
|
|
3420
|
+
self.evtTerminate(terminationCause)
|
|
3421
|
+
elif (_g == 220):
|
|
3422
|
+
self.disposeHTTP()
|
|
3423
|
+
self.notifyStatus("DISCONNECTED")
|
|
3424
|
+
self.notifyServerErrorIfCauseIsError(terminationCause)
|
|
3425
|
+
self.state.goto_m_from_session(100)
|
|
3426
|
+
self.cancel_evtTransportTimeout()
|
|
3427
|
+
self.evtEndSession()
|
|
3428
|
+
self.evtTerminate(terminationCause)
|
|
3429
|
+
elif (_g == 230):
|
|
3430
|
+
self.disposeHTTP()
|
|
3431
|
+
self.notifyStatus("DISCONNECTED")
|
|
3432
|
+
self.notifyServerErrorIfCauseIsError(terminationCause)
|
|
3433
|
+
self.state.goto_m_from_session(100)
|
|
3434
|
+
self.cancel_evtTransportTimeout()
|
|
3435
|
+
self.evtEndSession()
|
|
3436
|
+
self.evtTerminate(terminationCause)
|
|
3437
|
+
elif (_g == 240):
|
|
3438
|
+
self.disposeWS()
|
|
3439
|
+
self.notifyStatus("DISCONNECTED")
|
|
3440
|
+
self.notifyServerErrorIfCauseIsError(terminationCause)
|
|
3441
|
+
self.state.goto_m_from_ws(100)
|
|
3442
|
+
self.exit_ws_to_m()
|
|
3443
|
+
self.evtTerminate(terminationCause)
|
|
3444
|
+
elif (_g == 250):
|
|
3445
|
+
self.disposeWS()
|
|
3446
|
+
self.notifyStatus("DISCONNECTED")
|
|
3447
|
+
self.notifyServerErrorIfCauseIsError(terminationCause)
|
|
3448
|
+
self.state.goto_m_from_wp(100)
|
|
3449
|
+
self.exit_wp_to_m()
|
|
3450
|
+
self.evtTerminate(terminationCause)
|
|
3451
|
+
elif (_g == 260):
|
|
3452
|
+
self.disposeHTTP()
|
|
3453
|
+
self.notifyStatus("DISCONNECTED")
|
|
3454
|
+
self.notifyServerErrorIfCauseIsError(terminationCause)
|
|
3455
|
+
self.state.goto_m_from_rec(100)
|
|
3456
|
+
self.exit_rec_to_m()
|
|
3457
|
+
self.evtTerminate(terminationCause)
|
|
3458
|
+
elif (_g == 270):
|
|
3459
|
+
if (self.state.s_h == 710):
|
|
3460
|
+
self.disposeHTTP()
|
|
3461
|
+
self.notifyStatus("DISCONNECTED")
|
|
3462
|
+
self.notifyServerErrorIfCauseIsError(terminationCause)
|
|
3463
|
+
self.state.goto_m_from_hs(100)
|
|
3464
|
+
self.exit_hs_to_m()
|
|
3465
|
+
self.evtTerminate(terminationCause)
|
|
3466
|
+
elif (self.state.s_h == 720):
|
|
3467
|
+
self.disposeHTTP()
|
|
3468
|
+
self.notifyStatus("DISCONNECTED")
|
|
3469
|
+
self.notifyServerErrorIfCauseIsError(terminationCause)
|
|
3470
|
+
self.state.goto_m_from_hp(100)
|
|
3471
|
+
self.exit_hp_to_m()
|
|
3472
|
+
self.evtTerminate(terminationCause)
|
|
3473
|
+
else:
|
|
3474
|
+
pass
|
|
3475
|
+
else:
|
|
3476
|
+
pass
|
|
3477
|
+
|
|
3317
3478
|
def evtTransportError(self):
|
|
3318
3479
|
self.traceEvent("transport.error")
|
|
3319
3480
|
_g = self.state.s_m
|
|
@@ -5285,6 +5446,16 @@ class com_lightstreamer_client_internal_ClientMachine:
|
|
|
5285
5446
|
self.cancel_evtCtrlTimeout()
|
|
5286
5447
|
self.evtCheckCtrlRequests()
|
|
5287
5448
|
|
|
5449
|
+
def evtCtrlFatalError(self,code,msg):
|
|
5450
|
+
self.traceEvent("ctrl.fatal.error")
|
|
5451
|
+
if (self.state.s_ctrl == 1102):
|
|
5452
|
+
self.disposeHTTP()
|
|
5453
|
+
self.notifyStatus("DISCONNECTED")
|
|
5454
|
+
self.notifyServerError_ERROR(code,msg)
|
|
5455
|
+
self.state.goto_m_from_ctrl(100)
|
|
5456
|
+
self.exit_ctrl_to_m()
|
|
5457
|
+
self.evtTerminate(com_lightstreamer_client_internal__ClientMachine_TerminationCause.TC_standardError(code,msg))
|
|
5458
|
+
|
|
5288
5459
|
def evtCtrlError(self):
|
|
5289
5460
|
self.traceEvent("ctrl.error")
|
|
5290
5461
|
if (self.state.s_ctrl == 1102):
|
|
@@ -5790,7 +5961,16 @@ class com_lightstreamer_client_internal_ClientMachine:
|
|
|
5790
5961
|
_gthis.lock.synchronized(_hx_local_6)
|
|
5791
5962
|
com_lightstreamer_internal__Threads_Threads_Fields_.sessionThread.loop.call_soon_threadsafe(_hx_local_7)
|
|
5792
5963
|
onError = _hx_local_8
|
|
5793
|
-
|
|
5964
|
+
def _hx_local_11(client,code,error):
|
|
5965
|
+
def _hx_local_10():
|
|
5966
|
+
def _hx_local_9():
|
|
5967
|
+
if client.isDisposed():
|
|
5968
|
+
return
|
|
5969
|
+
_gthis.evtTransportFatalError(code,error)
|
|
5970
|
+
_gthis.lock.synchronized(_hx_local_9)
|
|
5971
|
+
com_lightstreamer_internal__Threads_Threads_Fields_.sessionThread.loop.call_soon_threadsafe(_hx_local_10)
|
|
5972
|
+
onFatalError = _hx_local_11
|
|
5973
|
+
return self.wsFactory(url,headers,onOpen,onText,onError,onFatalError)
|
|
5794
5974
|
|
|
5795
5975
|
def openWS_Create(self):
|
|
5796
5976
|
self.connectTs = python_lib_Timeit.default_timer()
|
|
@@ -5915,11 +6095,20 @@ class com_lightstreamer_client_internal_ClientMachine:
|
|
|
5915
6095
|
_gthis.lock.synchronized(_hx_local_3)
|
|
5916
6096
|
com_lightstreamer_internal__Threads_Threads_Fields_.sessionThread.loop.call_soon_threadsafe(_hx_local_4)
|
|
5917
6097
|
onError = _hx_local_5
|
|
5918
|
-
def
|
|
5919
|
-
def
|
|
6098
|
+
def _hx_local_8(client,errCode,errMsg):
|
|
6099
|
+
def _hx_local_7():
|
|
6100
|
+
def _hx_local_6():
|
|
6101
|
+
if client.isDisposed():
|
|
6102
|
+
return
|
|
6103
|
+
_gthis.evtTransportFatalError(errCode,errMsg)
|
|
6104
|
+
_gthis.lock.synchronized(_hx_local_6)
|
|
6105
|
+
com_lightstreamer_internal__Threads_Threads_Fields_.sessionThread.loop.call_soon_threadsafe(_hx_local_7)
|
|
6106
|
+
onFatalError = _hx_local_8
|
|
6107
|
+
def _hx_local_10():
|
|
6108
|
+
def _hx_local_9(client):
|
|
5920
6109
|
pass
|
|
5921
|
-
return self.httpFactory(url,req.getEncodedString(),headers,onText,onError,
|
|
5922
|
-
return
|
|
6110
|
+
return self.httpFactory(url,req.getEncodedString(),headers,onText,onError,onFatalError,_hx_local_9)
|
|
6111
|
+
return _hx_local_10()
|
|
5923
6112
|
|
|
5924
6113
|
def sendCreateHTTP(self):
|
|
5925
6114
|
req = com_lightstreamer_internal_RequestBuilder()
|
|
@@ -6820,16 +7009,25 @@ class com_lightstreamer_client_internal_ClientMachine:
|
|
|
6820
7009
|
_gthis.lock.synchronized(_hx_local_3)
|
|
6821
7010
|
com_lightstreamer_internal__Threads_Threads_Fields_.sessionThread.loop.call_soon_threadsafe(_hx_local_4)
|
|
6822
7011
|
onError = _hx_local_5
|
|
6823
|
-
def _hx_local_8(client):
|
|
7012
|
+
def _hx_local_8(client,errCode,errMsg):
|
|
6824
7013
|
def _hx_local_7():
|
|
6825
7014
|
def _hx_local_6():
|
|
6826
7015
|
if client.isDisposed():
|
|
6827
7016
|
return
|
|
6828
|
-
_gthis.
|
|
7017
|
+
_gthis.evtCtrlFatalError(errCode,errMsg)
|
|
6829
7018
|
_gthis.lock.synchronized(_hx_local_6)
|
|
6830
7019
|
com_lightstreamer_internal__Threads_Threads_Fields_.sessionThread.loop.call_soon_threadsafe(_hx_local_7)
|
|
6831
|
-
|
|
6832
|
-
|
|
7020
|
+
onFatalError = _hx_local_8
|
|
7021
|
+
def _hx_local_11(client):
|
|
7022
|
+
def _hx_local_10():
|
|
7023
|
+
def _hx_local_9():
|
|
7024
|
+
if client.isDisposed():
|
|
7025
|
+
return
|
|
7026
|
+
_gthis.evtCtrlDone()
|
|
7027
|
+
_gthis.lock.synchronized(_hx_local_9)
|
|
7028
|
+
com_lightstreamer_internal__Threads_Threads_Fields_.sessionThread.loop.call_soon_threadsafe(_hx_local_10)
|
|
7029
|
+
onDone = _hx_local_11
|
|
7030
|
+
self.ctrl_http = self.ctrlFactory(url,body,headers,onText,onError,onFatalError,onDone)
|
|
6833
7031
|
|
|
6834
7032
|
def prepareBatchWS(self,reqType,pendings,requestLimit):
|
|
6835
7033
|
if (len(pendings) <= 0):
|
|
@@ -8492,7 +8690,7 @@ class haxe_io_Bytes:
|
|
|
8492
8690
|
__slots__ = ("length", "b")
|
|
8493
8691
|
_hx_fields = ["length", "b"]
|
|
8494
8692
|
_hx_methods = ["getString"]
|
|
8495
|
-
_hx_statics = ["ofString"]
|
|
8693
|
+
_hx_statics = ["alloc", "ofString"]
|
|
8496
8694
|
|
|
8497
8695
|
def __init__(self,length,b):
|
|
8498
8696
|
self.length = length
|
|
@@ -8503,6 +8701,10 @@ class haxe_io_Bytes:
|
|
|
8503
8701
|
raise haxe_Exception.thrown(haxe_io_Error.OutsideBounds)
|
|
8504
8702
|
return self.b[pos:pos+_hx_len].decode('UTF-8','replace')
|
|
8505
8703
|
|
|
8704
|
+
@staticmethod
|
|
8705
|
+
def alloc(length):
|
|
8706
|
+
return haxe_io_Bytes(length,bytearray(length))
|
|
8707
|
+
|
|
8506
8708
|
@staticmethod
|
|
8507
8709
|
def ofString(s,encoding = None):
|
|
8508
8710
|
b = bytearray(s,"UTF-8")
|
|
@@ -11269,9 +11471,11 @@ class com_lightstreamer_internal_Globals:
|
|
|
11269
11471
|
self.lock.synchronized(_hx_local_2)
|
|
11270
11472
|
|
|
11271
11473
|
def toString(self):
|
|
11272
|
-
def
|
|
11273
|
-
|
|
11274
|
-
|
|
11474
|
+
def _hx_local_1():
|
|
11475
|
+
def _hx_local_0():
|
|
11476
|
+
return "{}"
|
|
11477
|
+
return self.lock.synchronized(_hx_local_0)
|
|
11478
|
+
return _hx_local_1()
|
|
11275
11479
|
|
|
11276
11480
|
com_lightstreamer_internal_Globals._hx_class = com_lightstreamer_internal_Globals
|
|
11277
11481
|
|
|
@@ -11958,22 +12162,23 @@ com_lightstreamer_internal_IFactory._hx_class = com_lightstreamer_internal_IFact
|
|
|
11958
12162
|
class com_lightstreamer_internal_Factory:
|
|
11959
12163
|
_hx_class_name = "com.lightstreamer.internal.Factory"
|
|
11960
12164
|
_hx_is_interface = "False"
|
|
11961
|
-
__slots__ = ("connectionOptions",)
|
|
11962
|
-
_hx_fields = ["connectionOptions"]
|
|
12165
|
+
__slots__ = ("connectionOptions", "connectionDetails")
|
|
12166
|
+
_hx_fields = ["connectionOptions", "connectionDetails"]
|
|
11963
12167
|
_hx_methods = ["createWsClient", "createHttpClient", "createCtrlClient", "createReachabilityManager", "createTimer", "randomMillis", "createPageLifecycleFactory"]
|
|
11964
12168
|
_hx_interfaces = [com_lightstreamer_internal_IFactory]
|
|
11965
12169
|
|
|
11966
12170
|
def __init__(self,client):
|
|
11967
12171
|
self.connectionOptions = client.connectionOptions
|
|
12172
|
+
self.connectionDetails = client.connectionDetails
|
|
11968
12173
|
|
|
11969
|
-
def createWsClient(self,url,headers,onOpen,onText,onError):
|
|
12174
|
+
def createWsClient(self,url,headers,onOpen,onText,onError,onFatalError):
|
|
11970
12175
|
return com_lightstreamer_internal_WsClient(url,headers,self.connectionOptions.getProxy(),com_lightstreamer_internal_Globals.instance.getTrustManagerFactory(),onOpen,onText,onError)
|
|
11971
12176
|
|
|
11972
|
-
def createHttpClient(self,url,body,headers,onText,onError,onDone):
|
|
12177
|
+
def createHttpClient(self,url,body,headers,onText,onError,onFatalError,onDone):
|
|
11973
12178
|
return com_lightstreamer_internal_HttpClient(url,body,headers,self.connectionOptions.getProxy(),com_lightstreamer_internal_Globals.instance.getTrustManagerFactory(),onText,onError,onDone)
|
|
11974
12179
|
|
|
11975
|
-
def createCtrlClient(self,url,body,headers,onText,onError,onDone):
|
|
11976
|
-
return self.createHttpClient(url,body,headers,onText,onError,onDone)
|
|
12180
|
+
def createCtrlClient(self,url,body,headers,onText,onError,onFatalError,onDone):
|
|
12181
|
+
return self.createHttpClient(url,body,headers,onText,onError,onFatalError,onDone)
|
|
11977
12182
|
|
|
11978
12183
|
def createReachabilityManager(self,host):
|
|
11979
12184
|
return com_lightstreamer_internal_ReachabilityManager()
|
|
@@ -14729,6 +14934,86 @@ class haxe_ValueException(haxe_Exception):
|
|
|
14729
14934
|
haxe_ValueException._hx_class = haxe_ValueException
|
|
14730
14935
|
|
|
14731
14936
|
|
|
14937
|
+
class haxe_crypto_Base64:
|
|
14938
|
+
_hx_class_name = "haxe.crypto.Base64"
|
|
14939
|
+
_hx_is_interface = "False"
|
|
14940
|
+
__slots__ = ()
|
|
14941
|
+
_hx_statics = ["CHARS", "BYTES", "decode"]
|
|
14942
|
+
|
|
14943
|
+
@staticmethod
|
|
14944
|
+
def decode(_hx_str,complement = None):
|
|
14945
|
+
if (complement is None):
|
|
14946
|
+
complement = True
|
|
14947
|
+
if complement:
|
|
14948
|
+
while (HxString.charCodeAt(_hx_str,(len(_hx_str) - 1)) == 61):
|
|
14949
|
+
_hx_str = HxString.substr(_hx_str,0,-1)
|
|
14950
|
+
return haxe_crypto_BaseCode(haxe_crypto_Base64.BYTES).decodeBytes(haxe_io_Bytes.ofString(_hx_str))
|
|
14951
|
+
haxe_crypto_Base64._hx_class = haxe_crypto_Base64
|
|
14952
|
+
|
|
14953
|
+
|
|
14954
|
+
class haxe_crypto_BaseCode:
|
|
14955
|
+
_hx_class_name = "haxe.crypto.BaseCode"
|
|
14956
|
+
_hx_is_interface = "False"
|
|
14957
|
+
__slots__ = ("base", "nbits", "tbl")
|
|
14958
|
+
_hx_fields = ["base", "nbits", "tbl"]
|
|
14959
|
+
_hx_methods = ["initTable", "decodeBytes"]
|
|
14960
|
+
|
|
14961
|
+
def __init__(self,base):
|
|
14962
|
+
self.tbl = None
|
|
14963
|
+
_hx_len = base.length
|
|
14964
|
+
nbits = 1
|
|
14965
|
+
while (_hx_len > ((1 << nbits))):
|
|
14966
|
+
nbits = (nbits + 1)
|
|
14967
|
+
if ((nbits > 8) or ((_hx_len != ((1 << nbits))))):
|
|
14968
|
+
raise haxe_Exception.thrown("BaseCode : base length must be a power of two.")
|
|
14969
|
+
self.base = base
|
|
14970
|
+
self.nbits = nbits
|
|
14971
|
+
|
|
14972
|
+
def initTable(self):
|
|
14973
|
+
tbl = list()
|
|
14974
|
+
_g = 0
|
|
14975
|
+
while (_g < 256):
|
|
14976
|
+
i = _g
|
|
14977
|
+
_g = (_g + 1)
|
|
14978
|
+
python_internal_ArrayImpl._set(tbl, i, -1)
|
|
14979
|
+
_g = 0
|
|
14980
|
+
_g1 = self.base.length
|
|
14981
|
+
while (_g < _g1):
|
|
14982
|
+
i = _g
|
|
14983
|
+
_g = (_g + 1)
|
|
14984
|
+
python_internal_ArrayImpl._set(tbl, self.base.b[i], i)
|
|
14985
|
+
self.tbl = tbl
|
|
14986
|
+
|
|
14987
|
+
def decodeBytes(self,b):
|
|
14988
|
+
nbits = self.nbits
|
|
14989
|
+
if (self.tbl is None):
|
|
14990
|
+
self.initTable()
|
|
14991
|
+
tbl = self.tbl
|
|
14992
|
+
size = ((b.length * nbits) >> 3)
|
|
14993
|
+
out = haxe_io_Bytes.alloc(size)
|
|
14994
|
+
buf = 0
|
|
14995
|
+
curbits = 0
|
|
14996
|
+
pin = 0
|
|
14997
|
+
pout = 0
|
|
14998
|
+
while (pout < size):
|
|
14999
|
+
while (curbits < 8):
|
|
15000
|
+
curbits = (curbits + nbits)
|
|
15001
|
+
buf = (buf << nbits)
|
|
15002
|
+
pos = pin
|
|
15003
|
+
pin = (pin + 1)
|
|
15004
|
+
i = python_internal_ArrayImpl._get(tbl, b.b[pos])
|
|
15005
|
+
if (i == -1):
|
|
15006
|
+
raise haxe_Exception.thrown("BaseCode : invalid encoded char")
|
|
15007
|
+
buf = (buf | i)
|
|
15008
|
+
curbits = (curbits - 8)
|
|
15009
|
+
pos1 = pout
|
|
15010
|
+
pout = (pout + 1)
|
|
15011
|
+
out.b[pos1] = (((buf >> curbits) & 255) & 255)
|
|
15012
|
+
return out
|
|
15013
|
+
|
|
15014
|
+
haxe_crypto_BaseCode._hx_class = haxe_crypto_BaseCode
|
|
15015
|
+
|
|
15016
|
+
|
|
14732
15017
|
class haxe_ds_IntMap:
|
|
14733
15018
|
_hx_class_name = "haxe.ds.IntMap"
|
|
14734
15019
|
_hx_is_interface = "False"
|
|
@@ -15308,8 +15593,8 @@ sys_thread__Thread_HxThread.mainThread.events = sys_thread_EventLoop()
|
|
|
15308
15593
|
com_lightstreamer_client__ConnectionDetails_ConnectionDetails_Fields_.DEFAULT_SERVER = None
|
|
15309
15594
|
com_lightstreamer_internal__Constants_Constants_Fields_.TLCP_VERSION = "TLCP-2.5.0"
|
|
15310
15595
|
com_lightstreamer_internal__Constants_Constants_Fields_.FULL_TLCP_VERSION = (HxOverrides.stringOrNull(com_lightstreamer_internal__Constants_Constants_Fields_.TLCP_VERSION) + ".lightstreamer.com")
|
|
15311
|
-
com_lightstreamer_internal__Constants_Constants_Fields_.LS_LIB_VERSION = (("2.2.
|
|
15312
|
-
com_lightstreamer_internal__Constants_Constants_Fields_.LS_CID = "v
|
|
15596
|
+
com_lightstreamer_internal__Constants_Constants_Fields_.LS_LIB_VERSION = (("2.2.3" + " build ") + "20260820")
|
|
15597
|
+
com_lightstreamer_internal__Constants_Constants_Fields_.LS_CID = "v Wntytg4pkpW37AM3P4hwLri8M4OD6Ah6e"
|
|
15313
15598
|
com_lightstreamer_internal__Constants_Constants_Fields_.LS_LIB_NAME = "python_client"
|
|
15314
15599
|
com_lightstreamer_internal__Constants_Constants_Fields_.LS_CREATE_REALM = ""
|
|
15315
15600
|
LSLightstreamerClient.LIB_NAME = com_lightstreamer_internal__Constants_Constants_Fields_.LS_LIB_NAME
|
|
@@ -15359,4 +15644,6 @@ com_lightstreamer_log__LoggerTools_LoggerTools_Fields_.reachabilityLogger = com_
|
|
|
15359
15644
|
com_lightstreamer_log__LoggerTools_LoggerTools_Fields_.subscriptionLogger = com_lightstreamer_log_LogManager.getLogger("lightstreamer.subscriptions")
|
|
15360
15645
|
com_lightstreamer_log__LoggerTools_LoggerTools_Fields_.messageLogger = com_lightstreamer_log_LogManager.getLogger("lightstreamer.messages")
|
|
15361
15646
|
com_lightstreamer_log__LoggerTools_LoggerTools_Fields_.cookieLogger = com_lightstreamer_log_LogManager.getLogger("lightstreamer.cookies")
|
|
15362
|
-
com_lightstreamer_log__LoggerTools_LoggerTools_Fields_.pageLogger = com_lightstreamer_log_LogManager.getLogger("lightstreamer.page")
|
|
15647
|
+
com_lightstreamer_log__LoggerTools_LoggerTools_Fields_.pageLogger = com_lightstreamer_log_LogManager.getLogger("lightstreamer.page")
|
|
15648
|
+
haxe_crypto_Base64.CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
|
15649
|
+
haxe_crypto_Base64.BYTES = haxe_io_Bytes.ofString(haxe_crypto_Base64.CHARS)
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# Copyright (C) 2023 Lightstreamer Srl
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
1
14
|
from .ls_python_client_api import *
|
|
2
15
|
from .ls_python_client_haxe import LSConsoleLoggerProvider, LSConsoleLogLevel, LSProxy, LSSubscription, LSConnectionDetails, LSConnectionOptions, LSLightstreamerClient
|
|
3
16
|
|
|
@@ -1118,6 +1131,8 @@ class LightstreamerClient:
|
|
|
1118
1131
|
:param delayTimeout: a timeout, expressed in milliseconds. If higher than the Server configured timeout on missing messages, the latter will be used instead. The parameter is optional; if a negative value is supplied, the Server configured timeout on missing messages will be applied. This timeout is ignored for the special "UNORDERED_MESSAGES" sequence, although a server-side timeout on missing messages still applies.
|
|
1119
1132
|
:param listener: an object suitable for receiving notifications about the processing outcome. The parameter is optional; if not supplied, no notification will be available.
|
|
1120
1133
|
:param enqueueWhileDisconnected: if this flag is set to true, and the client is in a disconnected status when the provided message is handled, then the message is not aborted right away but is queued waiting for a new session. Note that the message can still be aborted later when a new session is established.
|
|
1134
|
+
|
|
1135
|
+
.. seealso:: `Client-to-Server Messaging in Lightstreamer Explained <https://lightstreamer.com/blog/client-to-server-messaging-in-lightstreamer-explained/>`_
|
|
1121
1136
|
"""
|
|
1122
1137
|
self.delegate.sendMessage(message, sequence, delayTimeout, listener, enqueueWhileDisconnected)
|
|
1123
1138
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: lightstreamer-client-lib
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.3
|
|
4
4
|
Summary: Lightstreamer Client SDK
|
|
5
5
|
Author-email: Lightstreamer Srl <support@lightstreamer.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -15,6 +15,7 @@ Description-Content-Type: text/markdown
|
|
|
15
15
|
License-File: LICENSE
|
|
16
16
|
Requires-Dist: aiohttp>=3.8.6
|
|
17
17
|
Requires-Dist: jsonpatch>=1.33
|
|
18
|
+
Dynamic: license-file
|
|
18
19
|
|
|
19
20
|
# Lightstreamer Python Client SDK
|
|
20
21
|
|
|
@@ -34,7 +35,7 @@ The sdk is supported on Python 3.7 and above.
|
|
|
34
35
|
|
|
35
36
|
## Quickstart
|
|
36
37
|
|
|
37
|
-
To connect to a Lightstreamer Server, a [LightstreamerClient](https://lightstreamer.com/api/ls-python-client/2.2.
|
|
38
|
+
To connect to a Lightstreamer Server, a [LightstreamerClient](https://lightstreamer.com/api/ls-python-client/2.2.3/lightstreamer.html#lightstreamer.client.ls_python_client_wrapper.LightstreamerClient) object has to be created, configured, and instructed to connect to the Lightstreamer Server.
|
|
38
39
|
A minimal version of the code that creates a LightstreamerClient and connects to the Lightstreamer Server on *https://push.lightstreamer.com* will look like this:
|
|
39
40
|
|
|
40
41
|
```python
|
|
@@ -44,7 +45,7 @@ client = LightstreamerClient("http://push.lightstreamer.com/","DEMO")
|
|
|
44
45
|
client.connect()
|
|
45
46
|
```
|
|
46
47
|
|
|
47
|
-
For each subscription to be subscribed to a Lightstreamer Server a [Subscription](https://lightstreamer.com/api/ls-python-client/2.2.
|
|
48
|
+
For each subscription to be subscribed to a Lightstreamer Server a [Subscription](https://lightstreamer.com/api/ls-python-client/2.2.3/lightstreamer.html#lightstreamer.client.ls_python_client_wrapper.Subscription) instance is needed.
|
|
48
49
|
A simple Subscription containing three items and two fields to be subscribed in *MERGE* mode is easily created (see [Lightstreamer General Concepts](https://lightstreamer.com/docs/ls-server/latest/General%20Concepts.pdf)):
|
|
49
50
|
|
|
50
51
|
```python
|
|
@@ -54,7 +55,7 @@ sub.setRequestedSnapshot("yes")
|
|
|
54
55
|
client.subscribe(sub)
|
|
55
56
|
```
|
|
56
57
|
|
|
57
|
-
Before sending the subscription to the server, usually at least one [SubscriptionListener](https://lightstreamer.com/api/ls-python-client/2.2.
|
|
58
|
+
Before sending the subscription to the server, usually at least one [SubscriptionListener](https://lightstreamer.com/api/ls-python-client/2.2.3/lightstreamer.html#lightstreamer.client.ls_python_client_api.SubscriptionListener) is attached to the Subscription instance in order to consume the real-time updates. The following code shows the values of the fields *stock_name* and *last_price* each time a new update is received for the subscription:
|
|
58
59
|
|
|
59
60
|
```python
|
|
60
61
|
class SubListener(SubscriptionListener):
|
|
@@ -88,7 +89,7 @@ client.connect()
|
|
|
88
89
|
|
|
89
90
|
## Logging
|
|
90
91
|
|
|
91
|
-
To enable the internal client logger, create a [LoggerProvider](https://lightstreamer.com/api/ls-python-client/2.2.
|
|
92
|
+
To enable the internal client logger, create a [LoggerProvider](https://lightstreamer.com/api/ls-python-client/2.2.3/lightstreamer.html#lightstreamer.client.ls_python_client_api.LoggerProvider) and set it as the default provider of [LightstreamerClient](https://lightstreamer.com/api/ls-python-client/2.2.3/lightstreamer.html#lightstreamer.client.ls_python_client_wrapper.LightstreamerClient.setLoggerProvider).
|
|
92
93
|
|
|
93
94
|
```python
|
|
94
95
|
import sys, logging
|
|
@@ -107,7 +108,7 @@ Compatible with Lightstreamer Server since version 7.4.0.
|
|
|
107
108
|
|
|
108
109
|
- [Live demos](https://demos.lightstreamer.com/?p=lightstreamer&t=client&lclient=python)
|
|
109
110
|
|
|
110
|
-
- [API Reference](https://lightstreamer.com/api/ls-python-client/2.2.
|
|
111
|
+
- [API Reference](https://lightstreamer.com/api/ls-python-client/2.2.3/index.html)
|
|
111
112
|
|
|
112
113
|
## Support
|
|
113
114
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|