FreeOpcUa / python-opcua

LGPL Pure Python OPC-UA Client and Server
http://freeopcua.github.io/
GNU Lesser General Public License v3.0
1.32k stars 661 forks source link

Transfer Subscription Request #1522

Open qorinator opened 1 year ago

qorinator commented 1 year ago

Hi

I am using this library to modify an existing OPCUA test server that is connected to a device with an OPCUA client.

the connection works to a point and then it failed with this error message. note: i modified the permission_rules.py so that the check_validity always returns True.

sending service fault response: "The session id is not valid." (BadSessionIdInvalid)
Unknown message received NodeId(Identifier=841, NamespaceIndex=0, NodeIdType=<NodeIdType.FourByte: 1>) (User(role=<UserRole.Admin: 0>, name='smartgate'))
sending service fault response: "The server does not support the requested service." (BadServiceUnsupported)
sending service fault response: "The session id is not valid." (BadSessionIdInvalid)

I tried to mimic the work that was done on this issue https://github.com/FreeOpcUa/python-opcua/issues/594 where I always return 'ua.StatusCodes.Good'

however, this results on sending service fault response: "The session id is not valid." (BadSessionIdInvalid)

which I am guessing due to TransferSubscriptionsRequest actually need the subscription to be transferred from some session A to some session B.

I saw that in internal_session.py this function is not yet implemented

async def transfer_subscriptions(self, params: ua.TransferSubscriptionsParameters) -> List[ua.TransferResult]:
        # Subscriptions aren't bound to a Session and can be transfered!
        # https://reference.opcfoundation.org/Core/Part4/v104/5.13.7/
        raise NotImplementedError

I have looked at the reference, however i found the description to be a bit vague.

Is there anyone familiar with this request? and what kind of implementation is actually needed to be added for the transfer_subscription function ?