mirror of
https://github.com/axllent/mailpit.git
synced 2026-04-26 16:56:00 +03:00
[GH-ISSUE #319] If websocket is not working a boring overlay appears every 1 second #210
Labels
No labels
awaiting feedback
bug
docker
documentation
enhancement
github_actions
invalid
pull-request
question
stale
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/mailpit#210
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lisotton on GitHub (Jun 21, 2024).
Original GitHub issue: https://github.com/axllent/mailpit/issues/319
Hi,
I'm trying to replace a MailDev that we have behind a corporate reverse proxy, which does not support websockets well. And then a boring overlay appears every second because the websocket connection get disconnected.
This could be improved if with some options:
Unfortunately I will need to keep using MailDev, because the reverse proxy is handled at the corporate level, I don't have access to configure it and with this overlay, it is not a good experience.
Thanks :)
@axllent commented on GitHub (Jun 21, 2024):
Hi @lisotton. Could you please clarify what you mean with a "boring overlay"? Do you mean the overlay with the spinner in the middle?
This should only happen when Mailpit reconnects to a websocket, meaning it was connected, gets disconnected, and then reconnects again. At this point Mailpit does an automatic refresh the mailbox (or search etc) as the messages may have changed since it's last disconnection (eg: if you hibernate a laptop). It appears this is what you are describing, although this is the first time I've heard of a partially-working websocket - they generally either work or they don't.
Are you able to maintain a connection when you connect directly to Mailpit (not via your proxy)? Could you to please confirm for me is whether you are sure is an issue with the proxy, or is maybe the Mailpit server restarting every second?
If it is definitely your proxy, then maybe the best solution would be for Mailpit to stop reconnecting is there are more than "X" repeated successful websocket connections within a period of time, eg: if there > 3 disconnections within 15 seconds, then stop reconnecting altogether. This approach should be sufficient for bad/slow connections, and only apply to situations like yours. Just to repeat, Mailpit does not automatically poll the messages as these can be very expensive lookups (complex searches, lots of mail), so you could need to click on the inbox to manually refresh (this is what users without websocket support need to do).
I'd appreciate in your feedback, thanks.
@lisotton commented on GitHub (Jun 21, 2024):
Hi @axllent, thanks for your quick reaction.
Yes, I'm referring to the overlay with the spinner in the middle, but it appear so fast and disappear that looks like the whole page is blinking.
It is not that the websocket is partially working, the point is that the reverse proxy is not maintaining the connection, so as soon as the JavaScript tries to establish the connection with the websocket, the connection is closed at the same instant by the backend and then a request to
/api/v1/messages?limit=50is done. And this keeps happening every 1 second and the page blinking.If I connect directly to Mailpit, it works fine, but when it goes through the reverse proxy, the websocket is not maintained.
I agree with your solution to stop repeating the refresh if had more than 3 disconnections within a specific period.
About the point 1. I agree that it is necessary to show to the user that the mailbox is reloading, but if this is happening in the background, maybe this is not needed to the user. I agree with you that the feedback is needed if the user clicks on the inbox manually to refresh, otherwise it looks like nothing happened with the click.
@axllent commented on GitHub (Jun 21, 2024):
Thanks for the feedback @lisotton, very useful information. I am actually considering two different approaches:
I think both approaches have merit, so maybe a combination of the two is the right answer. From your perspective the only thing you would notice is the icon changing 3 times next to Inbox between an envelope (meaning the websocket is connected) and a "refresh icon" (meaning you have to refresh manually) - and after 3 or 4 seconds it'll just stay as the refresh icon.
vs 
Let me know if you think this is an acceptable "fix" (workaround) for your issue? If so, I will implement this tomorrow (it's midnight here).
@lisotton commented on GitHub (Jun 21, 2024):
@axllent I like the first approach, so no connect & disconnect in background forever. But I also like your suggestion of the refresh icon to indicate that the user should refresh it manually.
I think this solution will make Mailpit usable in my condition. We will instruct the users that when they are expecting a new message, they should refresh manually.
Take your time to rest, I'm still in the middle of my day :)
@axllent commented on GitHub (Jun 22, 2024):
A fix for your issue has been released in v1.18.7. Please feel free to re-open this ticket if you continue to experience issues, and please let me know if it does solve your issue. Thanks.