Phase 5a: persistent websocket with request ids and reconnect
continuous-integration/drone/push Build encountered an error
continuous-integration/drone/push Build encountered an error
Client (ts/network_ts.ts): one WebSocket per page. Commands queue and go out one at a time with a client-chosen id; the response is matched on the echoed id (or to the in-flight request for older servers). 12 s timeout per request, exponential-backoff reconnect (0.5 s to 10 s), the in-flight request is retried after a reconnect, and log polls are de-duplicated so they cannot pile up behind a stalled connection. The old global flag that silently dropped any request made while another was in flight is gone. Server (src/webserver.go): the /data/ handler now serves any number of commands on one connection (it used to break out of its loop after the first reply without closing the socket, leaving it open and deaf; the old client papered over that by opening a new socket per request). Connection closed on exit, request id echoed in the response. Test: TestWSServesMultipleCommandsPerConnection.
This commit is contained in:
1 parent
cbc5bc5da2
commit
3a3ba861dc
8 files changed
+475
-242
No files matched your search
@@ -5,6 +5,10 @@ type RequestStruct struct {
|
||||
// Befehle an xTeVe
|
||||
Cmd string `json:"cmd"`
|
||||
|
||||
// Client-chosen request id, echoed in the response so the web UI can
|
||||
// match answers on a long-lived connection.
|
||||
ID string `json:"id,omitempty"`
|
||||
|
||||
// Benutzer
|
||||
DeleteUser bool `json:"deleteUser,omitempty"`
|
||||
UserData map[string]any `json:"userData,omitempty"`
|
||||
@@ -73,6 +77,8 @@ type RequestStruct struct {
|
||||
|
||||
// ResponseStruct : Antworten an den Client (WEB)
|
||||
type ResponseStruct struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
|
||||
ClientInfo struct {
|
||||
ARCH string `json:"arch"`
|
||||
Branch string `json:"branch,omitempty"`
|
||||
|
||||
Reference in new issue
Block a user