honojs / hono

Web framework built on Web Standards
https://hono.dev
MIT License
19.01k stars 539 forks source link

Long Polling middleware and client? #2438

Open nakasyou opened 6 months ago

nakasyou commented 6 months ago

What is the feature you are proposing?

Most of web clients have supported WebSockets.

But currently, many proxies may be blocking WebSockets. It includes workplace and school proxies. Engine.io, as Socket.io core's README has such a description.

In my school, we often enjoy real-time web games for learning. Our school's iPad proxy is blocking WebSockets, but those games is able to working. I think the reason is those games is using Long Polling.

Other than this, I found many articles what workplace proxies blocked WebSocket, but I don't write it because articles is Japanese articles.

So I would like have Long Polling middleware. If Hono has this middleware, Hono may be "Web standard alternative to Socket.io"

nakasyou commented 6 months ago

reference articles

exoego commented 5 months ago

Long polling is one of streaming-ish method.

SSE (Sever-sent Events) is another streaming technology and Hono offers server-side implementation. You may use SSE with EventSource in client side.

nakasyou commented 5 months ago

Hi @exoego, I think some proxies block SSE. At least in my school. But I can't find the source, I'm sorry.

exoego commented 5 months ago

Oh... then plain polling or long polling would be a rescue