acouvreur / sablier

Start your containers on demand, shut them down automatically when there's no activity. Docker, Docker Swarm Mode and Kubernetes compatible.
https://acouvreur.github.io/sablier/
GNU Affero General Public License v3.0
1.17k stars 44 forks source link

Websocket traffic is not detected as activity #21

Open heffer opened 2 years ago

heffer commented 2 years ago

Hello, I'm using webtop / guacamole as ondemand service. If there is (after an initial HTTP request) only traffic activity via a websocket channel, this is not considered as activity. After the configured timeout the service is scale down (due to "inactivity"), even if the connection is actively used. Is there some configuration setting I'm missing to consider this?

Best regards Sven

acouvreur commented 2 years ago

The websocket activity is not handled by the plugin indeed. If you have any clue on how we could fix that I'll be happy to help!

oiBio commented 2 years ago

Just stumbled across this nice plugin. We host an Blazor Server App and could also use this functionality. Unfortunately I don't have an approach to tackle the problem. I'm still relatively new with Docker/Traeffik and co.

However, IIS Server from Microsoft has a similar functionality - which also recognises active WebSocket connections, but I have no idea how they solved this exactly.

acouvreur commented 2 years ago

The WebSocket Protocol is an independent TCP-based protocol. Its only relationship to HTTP is that its handshake is interpreted by HTTP servers as an Upgrade request.

Thus I'd need to create a TCP Middleware and not an HTTP Middleware as the current one is.

To my knowledge, it's not yet possible to create custom TCP Middleware as plugins.

Although TCP Middleware are a thing https://github.com/traefik/traefik/tree/master/pkg/middlewares/tcp

Maybe I'll open an issue about it.

DNF-SaS commented 1 year ago

Looking forward to WebSocket-handling. Would be a really great feature for hosting Blazor Server.

tomaszduda23 commented 6 months ago

@acouvreur you could implement websocket support in that way https://github.com/acouvreur/sablier/pull/242

github-actions[bot] commented 5 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

acouvreur commented 4 months ago

With the work in progress from @tomaszduda23, we'll keep this issue opened

github-actions[bot] commented 3 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.