mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-06-05 21:20:40 +02:00
updates how Client handles (re-)connection with the server
The client will update the proxy class serialization directly on the ProxyClass instance. this is the only time this get "updated". Now, the client also notifies the observers directly with the proxy object as this the serialization of the proxy class is now done through its `serialize` method (which we have overwritten in a previous commit).
This commit is contained in:
parent
e8f33eee4d
commit
0d5cef1537
@ -2,7 +2,7 @@ import asyncio
|
|||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
from typing import TypedDict, cast
|
from typing import TYPE_CHECKING, TypedDict, cast
|
||||||
|
|
||||||
import socketio # type: ignore
|
import socketio # type: ignore
|
||||||
|
|
||||||
@ -121,7 +121,13 @@ class Client:
|
|||||||
self.proxy, serialized_object=serialized_object
|
self.proxy, serialized_object=serialized_object
|
||||||
)
|
)
|
||||||
serialized_object["type"] = "DeviceConnection"
|
serialized_object["type"] = "DeviceConnection"
|
||||||
self.proxy._notify_changed("", loads(serialized_object))
|
if self.proxy._service_representation is not None:
|
||||||
|
# need to use object.__setattr__ to not trigger an observer notification
|
||||||
|
object.__setattr__(self.proxy, "_service_representation", serialized_object)
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
self.proxy._service_representation = serialized_object # type: ignore
|
||||||
|
self.proxy._notify_changed("", self.proxy)
|
||||||
self.proxy._connected = True
|
self.proxy._connected = True
|
||||||
|
|
||||||
async def _handle_disconnect(self) -> None:
|
async def _handle_disconnect(self) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user