angturil / SongRequestManager

Song Request Manager is an integrated, fully Customizable song request bot and Console for BeatSaber.
GNU Lesser General Public License v3.0
44 stars 33 forks source link

[Request] Websocket integration #14

Open megalon opened 5 years ago

megalon commented 5 years ago

Sending the request queue information over a websocket would allow users to display the queue in their Twitch overlay, similar to the HTTP Status mod.

I was able to display the request queue in my own stream by setting up a simple Node.js server on my gaming desktop, reading the SongRequestQueue.json file, and sending that through a GET response to a small local webpage. I then displayed the webpage in OBS with the bowser source, similar to the HTTP Status mod, and was able to show the request queue on stream.

Here it is in the bottom left cardboard-requests The information stored in the SongRequestQueue.json was perfect for displaying in overlay, but it would be much more convenient to connect to a websocket instead of running a local server. I had to watch the file for changes then update the queue accordingly.

Some possible events that could be sent over the websocket:

Event Description
menu Send the current request queue to the websocket. This would be useful for initial connection. As far as I'm aware, there is no way to send data upon connection to a websocket, so simply sending out the queue when the player loads to the menu would be an easy solution.
requestPlayed Send the song info for whatever song is selected when the "play" button is clicked in the request queue.
requestAdded Send the song info for the new song that is requested.
requestSkipped Send the song info for the song that was just skipped.
requestBanned Send the song info for the song that was just banned.
angturil commented 5 years ago

I can add that. You should know that we already generate a queuelist.txt and queuestatus.txt file automatically with the queue content. The contenst of queuelist.txt can even be completely customized (can even hack html if you want).

---------- Original Message ---------- From: megalon notifications@github.com Date: May 6, 2019 at 4:35 AM

Sending the request queue information over a websocket would allow users to display the queue in their Twitch overlay, similar to the HTTP Status mod. I was able to display the request queue in my own stream by setting up a simple Node.js server on my gaming desktop, reading the SongRequestQueue.json file, and sending that through a GET response to a small local webpage. I then displayed the webpage in OBS with the bowser source, similar to the HTTP Status mod, and was able to show the request queue on stream. Here it is in the bottom left The information stored in the SongRequestQueue.json was perfect for displaying in overlay, but it would be much more convenient to connect to a websocket instead of running a local server. I had to watch the file for changes then update the queue accordingly. Some possible events that could be sent over the websocket:

  Event
  Description

  menu
  Send the current request queue to the websocket. This would be useful for initial connection. As far as I'm aware, there is no way to send data upon connection to a websocket, so simply sending out the queue when the player loads to the menu would be an easy solution.

  requestPlayed
  Send the song info for whatever song is selected when the "play" button is clicked in the request queue.

  requestAdded
  Send the song info for the new song that is requested.

  requestSkipped
  Send the song info for the song that was just skipped.

  requestBanned
  Send the song info for the song that was just banned.

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.

 

angturil commented 5 years ago

Nice hack on the songrequestqueue.json. It remains to be seen if that file remains as .json in future releases, but if it proves useful, I can consider keeping it that way.

Interpause commented 4 years ago

would it auto-update the in-game queue if I wrote directly to the songrequestqueue json?