My goal is to use a python process to control the graphic display on the server side. So I want to use the trame.app.get_client api to create a client instance in a Python script. I read some source code, it should be communicated with websocket, but I don’t know how to do it.
I see, so you have a fully working trame app (client+server), but you want another process (python) to start driving that app “remotely”.
Then indeed the get_client method is the way to go. Except that the url that needs to be passed is the websocket endpoint not the http website.
Once connected, you will have access to a state variable that let you do the same thing as on the server. You can modify it or react to it.
With that example, you can see that the url passed is ws://localhost:1234/ws. But that assume, the main trame process is ran locally with --port 1234 as arg.