oddbear / GoXLR-TouchPortal-Plugin

A plugin for TouchPortal that works like the StreamDeck plugin.
MIT License
15 stars 3 forks source link

Help with goxlr websocket #31

Open depsir opened 1 year ago

depsir commented 1 year ago

Hi, I'm trying to understand how the goxlr websocket works in order to develop some simple integrations. I'm looking at this project as a source of inspiration.

Looking at what you did I was hoping that creating a websocket server on port 6805 would be enough to get a connection from goxlr software, but nothing is happening.

Things that could be wrong:

Can you point me in the right direction or at least confirm that your current implementation still works with the latest goxlr app?

oddbear commented 1 year ago

Hi.

Cool, I am happy to share. Please just ask. :)

It should still work, at least the last time I checked (I can retest later, and come back). There should not be any difference to the mini and full, other than the mini has access to the sample routing row, and this is hidden in the application.

You need to set up a WebSocket server on ws://<ipAddress>:6805/?GOXLRApp (change the ipAddress part), and restart or reconnect from the GoXLR app (needs to be done manually)... You can only have one server per machine, since the GoXLR App can only connect to this fixed port.

I have a older simulator that you can test out: https://github.com/oddbear/GoXLR-TouchPortal-Plugin/releases/download/v0.7.0/Windows.GUI.Tooling.Plugin.Simulator.zip

Or check my notes at: https://github.com/oddbear/GoXLR-TouchPortal-Plugin/wiki/Development---specification https://github.com/oddbear/GoXLR-TouchPortal-Plugin/blob/master/Server/GoXLR.Server/SequenceDiagram.png

Hope this helps.

Oddbjørn

depsir commented 1 year ago

Hi, I made some progress which I would like to share. In the end I managed to connect my goxlr to a javascript (node js) script using goxlr websocket they developed for the streamdeck integration

First of all thanks to your simulator I confirmed that the connection protocol is still valid. I had to install .net 5 to make it run (with .net6 was not working) but after that the simulator started and the goxlr connected. It had some errors but probably due to protocol changes or something.

I managed to create a minimal example in javascript using ws library, which I share here for everyone in search of info.

  1. Install nodejs and create a new project with npm init in a new folder
  2. install ws lib with npm install --save ws
  3. create a file named ws.js with the content shown below
  4. run the script with node ws.js
  5. on the goxlr click "connect to stream deck". It should yield a successful message

Here the minimal code for ws.js

const WebSocket = require('ws')
const wss = new WebSocket.Server({ port: 6805 })
wss.on('connection', function connection(ws) {
   console.log("GoXLR connected")

  ws.on('message', function message(data) {
    console.log('received: %s', data);
  });
});
oddbear commented 1 year ago

Great. 👍

There was a change in the v0.18 of the Stream Deck plugin, so the Simulator might have some issues there (was built for the v0.17).

They changed some naming, and added support for states. See: https://github.com/oddbear/GoXLR-TouchPortal-Plugin/wiki/Development---specification (I gave the wrong link to this in my first post, sorry)

States was a little bit hard to setup last time I tried, it needed to do multiple calls that seemed unnecessary, or the GoXLR App would the wrong data. This might have been fixed in the GoXLR App now.