promql-langserver icon indicating copy to clipboard operation
promql-langserver copied to clipboard

Allow clients to connect over websocket

Open slrtbtfs opened this issue 6 years ago • 11 comments

slrtbtfs avatar Nov 06 '19 18:11 slrtbtfs

The go language server just does it's communication over plain tcp. That might actually be better than websockets.

slrtbtfs avatar Dec 16 '19 12:12 slrtbtfs

Some googling shows. TCP connections are nice but cannot be accessed from Webbrowsers so it might make sense to just implement both.

slrtbtfs avatar Dec 16 '19 12:12 slrtbtfs

github.com/gorilla/websocket seems to be the sanest go websocket lib around.

slrtbtfs avatar Dec 16 '19 12:12 slrtbtfs

This is mostly implemented here: https://github.com/prometheus-community/promql-langserver/blob/master/langserver/websocket.go

However this code still is still untested, so this issue won't be closed until this functionality is verified to work.

slrtbtfs avatar Feb 19 '20 17:02 slrtbtfs

Update: There exists the experimental websocket package for this now.

slrtbtfs avatar Feb 28 '20 16:02 slrtbtfs

similar implementation in rest package would be implemented with the websocket package right ?

haibeey avatar Mar 15 '20 13:03 haibeey

Regarding metrics?

The main difference is that http requests are upgraded to websocket connections that are kept open as long as the client is running.

slrtbtfs avatar Mar 15 '20 13:03 slrtbtfs

not regarding metrics. i mean would the websocket protocol also expose similar endpoint like hover, completion etc. as exposed in rest(using http) package?

haibeey avatar Mar 15 '20 13:03 haibeey

No, it opens one endpoint that upgrades to a websocket connection that serves as a transport layer for the Language Server Protocol.

The rest package is a alternative API for use cases where the LSP would be to complex, but only works for single queries which are usually small enough for HTTP GET requests (i.e. YAML files are intentionally not supported).

For an extensive discussion, see https://github.com/prometheus/prometheus/issues/6160 .

slrtbtfs avatar Mar 15 '20 17:03 slrtbtfs

clear now. Thanks. seems like the remaining checklist for this to close is testing the websocket module?

haibeey avatar Mar 17 '20 07:03 haibeey

Yes.

slrtbtfs avatar Mar 17 '20 11:03 slrtbtfs