Direct TCP Connection for Home Automation

I’m new to Mopidy and just started screwing around with it. I’m trying to write a module for an AMX control system (similar to Crestron or Control 4 if you are familiar with Home Automation). I’m not sure I’ll be able to negotiate websockets with the automation controller properly using native AMX or Crestron code. I can use HTTP POST RPC and it works fine but has it obvious limits without a persistent connection. Is there any way to connect directly to Mopidy similar to MPD but using the native API without the HTTP overhead? I wrote an MPD module a long, long time ago but it doesn’t seem to work because it relied on the list command which seems to have been replaced with find (I’m using GMusic). I also would prefer to simply use the native API anyway. Thanks much.

Actually, I just figured out how to format websockets traffic. I successfully created an HTTP upgrade header and then used the framing format which is simply $81 followed by the length of the message unless longer than 125. Am I missing anything else or is that it for the header? Pretty cool so far. Now to start making it do something!