diff --git a/pages/index.js b/pages/index.js index ee11f56..5ee10bf 100644 --- a/pages/index.js +++ b/pages/index.js @@ -121,8 +121,9 @@ export default class Home extends Component { shouldConnectSocket = true; } + console.log(`shouldConnectSocket = ${shouldConnectSocket}`); if (shouldConnectSocket) { - this.connectSocket(); + this.connectSocket(params.socketaddress); } } @@ -147,8 +148,10 @@ export default class Home extends Component { /** * Setup the HTTP Status connection */ - connectSocket() { - const socket = new WebSocket('ws://localhost:6557/socket'); + connectSocket(socketAddress) { + socketAddress = socketAddress === undefined ? 'ws://localhost' : `ws://${socketAddress}:6557/socket`; + console.log(`Connecting to ${socketAddress}`); + const socket = new WebSocket(socketAddress); socket.addEventListener('close', () => { console.log("Attempting to re-connect to the HTTP Status socket in 30 seconds."); setTimeout(() => this.connectSocket(), 30_000); @@ -318,13 +321,16 @@ export default class Home extends Component {
Provide a valid steam id for scoresaber or beatleader
Example: {document.location.origin}?id=76561198449412074
Example with Score Info: {document.location.origin}?id=76561198449412074&scoreinfo=true
+Example with Multiple PCs: {document.location.origin}?id=76561198449412074&scoreinfo=true&socketaddress=192.168.1.15
beatleader - Can be "true" if you wish to get player data from BeatLeader rather than scoresaber
-scoreinfo - Can be "true" if you want to show your current score (needs HTTP Status)
-playerstats - Can be "false" if you disable showing your stats (pp, global pos, etc)
-songinfo - Can be "true" if want to see information about the song (song name, bsr, song art, etc)
+beatleader - Can be "true" if you wish to get player data from BeatLeader rather than scoresaber
+scoreinfo - Can be "true" if you want to show your current score (needs HTTP Status)
+playerstats - Can be "false" if you disable showing your stats (pp, global pos, etc)
+songinfo - Can be "true" if want to see information about the song (song name, bsr, song art, etc)
+socketaddress - If you use multiple computers to stream (main pc, streaming pc) then this is for you.
+You can set it to the local address of the pc (eg: 192.168.1.15)
To use a option just add &key=value (eg: &songinfo=true)