[Python] disconnect message in python when closing waapi connection (wamp, autobahn)

Discussão em 'Python' iniciado por Stack, Junho 13, 2025.

  1. Stack

    Stack Membro Participativo

    With the code from the official website:
    https://www.audiokinetic.com/en/library/2024.1.5_8803/?source=SDK&id=waapi_client_python_rpc.html

    from waapi import WaapiClient, CannotConnectToWaapiException
    from pprint import pprint

    try:
    # Connecting to Waapi using default URL
    with WaapiClient() as client:
    # NOTE: client will automatically disconnect at the end of the scope

    # == Simple RPC without argument
    print("Getting Wwise instance information:")
    result = client.call("ak.wwise.core.getInfo")
    pprint(result)

    # == RPC with arguments
    print("Query the Default Work Unit information:")
    object_get_args = {
    "from": {
    "path": ["\\Actor-Mixer Hierarchy\\Default Work Unit"]
    },
    "options": {
    "return": ["id", "name", "type"]
    }
    }
    result = client.call("ak.wwise.core.object.get", object_get_args)
    pprint(result)
    except CannotConnectToWaapiException:
    print("Could not connect to Waapi: Is Wwise running and Wwise Authoring API enabled?")


    And here’s my custom code that handles the connection and disconnect:

    from waapi import WaapiClient, CannotConnectToWaapiException

    class WwiseConnector:
    def __init__(self):
    self.client = None

    def connect(self):
    try:
    self.client = WaapiClient()
    except CannotConnectToWaapiException:
    print("Cannot connect to WAAPI — is Wwise open with WAAPI enabled?")
    except Exception as e:
    print(f"Unexpected error: {e}")

    def disconnect(self):
    if self.client:
    self.client.disconnect()
    self.client = None


    However, I keep getting the following error:


    session closed with reason wamp.close.transport_lost [WAMP transport was lost without closing the session]
    ​

    Any idea why this is happening, and what’s the correct way to manage the WAAPI connection and disconnection lifecycle?

    Continue reading...

Compartilhe esta Página