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

WIP: Use websocket for notification instead of eventsource #26679

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lunny
Copy link
Member

@lunny lunny commented Aug 23, 2023

No description provided.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 23, 2023
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 23, 2023
@silverwind
Copy link
Member

Good choice with melody, it's something I've been eyeing as well because of easy broadcasts.

Comment on lines +10 to +11
const url = 'ws://' + window.location.host + '/ws';
const ws = new WebSocket(url);
Copy link
Member

@silverwind silverwind Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const url = 'ws://' + window.location.host + '/ws';
const ws = new WebSocket(url);
const ws = new WebSocket(`${window.location.origin.replace(/^http/, 'ws')}/ws`);

So it works on HTTPS as well. Should move this code to a separate modules/websocket.js file later.

@lunny
Copy link
Member Author

lunny commented Aug 23, 2023

Good choice with melody, it's something I've been eyeing as well because of easy broadcasts.

I just found melody has a memory switch system so I may change it back to gorilla/websocket directly.

@silverwind
Copy link
Member

I just found melody has a memory switch system

What do you mean? It seems pretty bare-bone: https://github.com/olahol/melody/blob/master/melody.go

@yardenshoham
Copy link
Member

What are the implications for the helm chart?

cc @pat-s

@silverwind
Copy link
Member

silverwind commented Aug 23, 2023

Reverse proxies may need adjustment to pass through Websockets unharmed. For nginx specifically:

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;

@pat-s
Copy link
Member

pat-s commented Feb 29, 2024

@lunny Do you plans to continue here?

@lunny
Copy link
Member Author

lunny commented Feb 29, 2024

@lunny Do you plans to continue here?

Yes. I will send some code recently. We need a pub/sub interfaces/services on server side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants