arl / statsviz

🚀 Visualise your Go program runtime metrics in real time in the browser
MIT License
3.19k stars 121 forks source link

Maybe it can be compatible with non-websocket mode? Some CDNs do not allow websocket connections. #117

Open mzzsfy opened 9 months ago

mzzsfy commented 9 months ago

If you use long polling, you will have the following advantages: better compatibility The server does not have multiple sets of time.Tick Have smaller dependencies

AlekSi commented 8 months ago

Another option is to use server-sent events.

mzzsfy commented 8 months ago

Another option is to use server-sent events.

good idea,use server-sent events changes much less than long polling

arl commented 8 months ago

The server does not have multiple sets of time.Tick

Statsviz uses a single timer. How would that change with any other solution? Unless I'm missing something you will still send stats at a given frequency, and you need a timer for that?

Can't you circumvent CDN restrictions by using a proxy?

Another option is to use server-sent events.

Server side events are a solution but they're one way only iirc, which would work with the current feature set but would prevent potential features we have in mind.

mzzsfy commented 8 months ago

Statsviz uses a single timer. How would that change with any other solution? Unless I'm missing something you will still send stats at a given frequency, and you need a timer for that?

When I open multiple pages, the custom indicator is called multiple times per second, which causes errors in some of my statistics. Using other solutions has nothing to do with this. Maybe I should open a separate issue.

Can't you circumvent CDN restrictions by using a proxy?

I don't have that access.

Server side events are a solution but they're one way only iirc, which would work with the current feature set but would prevent potential features we have in mind.

Can you give an example? If the client needs to send data, it can be solved through a new request.

AlekSi commented 8 months ago

If the client needs to send data, it can be solved through a new request.

That's what I think, too.

My main reason for wanting that improvement is to avoid dependency on github.com/gorilla/websocket.

arl commented 8 months ago

Can you give an example? If the client needs to send data, it can be solved through a new request

I'm thinking if the browser needs to send data to statsviz. For now it doesn't need to but SSE are a one way street (app->browser)

arl commented 8 months ago

the custom indicator is called multiple times per second

What custom indicator?

mzzsfy commented 8 months ago

What custom indicator?

userPlots statsviz.TimeSeries.GetValue is called multiple times per second

arl commented 8 months ago

What custom indicator?

userPlots statsviz.TimeSeries.GetValue is called multiple times per second

Uhm ok that's not normal. Could you please open an issue for this? And post a simple reproducer if you can?

mzzsfy commented 8 months ago

userPlots statsviz.TimeSeries.GetValue is called multiple times per second

Uhm ok that's not normal. Could you please open an issue for this? And post a simple reproducer if you can?

Open 2 web pages and you can see the phenomenon . I'll create a new issue

mzzsfy commented 8 months ago

https://github.com/arl/statsviz/issues/119