Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: use websocket instead of polling the status every 1.5 seconds #320

Open
xuancong84 opened this issue Mar 7, 2024 · 8 comments

Comments

@xuancong84
Copy link

Hi @vicwomg , just wondering if you are still working on this project, it might be a good idea to use WebSocket (which I was learning recently) to inform each client when the play status has changed. Making an HTTP request every 1.5 seconds per client can be too costly when there are more users.

@vicwomg
Copy link
Owner

vicwomg commented Mar 7, 2024

That's a great idea and I tried to implement websocket in v1.2 but ultimately went forward with polling because I was more familiar with it.

I am still working on the project when I have time, which is very limited. I welcome contributors.

@frankchau93
Copy link

Hi @vicwomg , just wondering if you are still working on this project, it might be a good idea to use WebSocket (which I was learning recently) to inform each client when the play status has changed. Making an HTTP request every 1.5 seconds per client can be too costly when there are more users.

Would definitely like to look into websockets. Hope it's possible.

@xuancong84
Copy link
Author

Would definitely like to look into websockets. Hope it's possible.

Actually, I have already implemented WebSocket in my fork, you may want to do a pull and merge, but it will be tough as there are too many changes. I am currently interested and doing adding songs by speaking the song title, using OpenAI's Whisper model to do speech-to-text.

@killerbytes
Copy link
Contributor

Would definitely like to look into websockets. Hope it's possible.

Actually, I have already implemented WebSocket in my fork, you may want to do a pull and merge, but it will be tough as there are too many changes. I am currently interested and doing adding songs by speaking the song title, using OpenAI's Whisper model to do speech-to-text.

@xuancong84 I tried your fork on a raspberry pi 4 4gb. It is not running very well

@xuancong84
Copy link
Author

xuancong84 commented Aug 24, 2024

@xuancong84 I tried your fork on a raspberry pi 4 4gb. It is not running very well

My fork has been deprecated. Use my new repository at https://github.com/xuancong84/OpenHomeKaraoke.git
My home Karaoke system is running this on a RPI4 8GB, so I am pretty sure it works.

@killerbytes
Copy link
Contributor

Yeah, I tried that on a 4GB. There's popping sound when volume normalization is enabled I think

@xuancong84
Copy link
Author

Yeah, I tried that on a 4GB. There's popping sound when volume normalization is enabled I think

Volume normalization only sets a fixed volume (based on the entire MP3 volume), the popping sound is due to CPU too slow while calculating the volume for a song. Try using better/faster Raspberry Pi.

@Apapora
Copy link

Apapora commented Dec 7, 2024

I reviewed your code and it still seems like it's using HTTP GET requests set over a repeating interval rather than using websockets.
In splash.html:
$(function () { getNowPlaying(); //Calls GET request setInterval(getNowPlaying, 1000); });

Am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants