gatus/core
Heitor 5f69351b6b
feat: support monitoring WebSocket endpoints (#511)
* feat: support monitoring WebSocket endpoints

WebSocket endpoints are automatically identified by the URL protocol
specification: `wss://` or `ws://`. The request body is used as the
"message" written to the server, and the answer is stored in the
`[BODY]`.

Optionally, the user can set the `jsonrpc` flag to automatically wrap
the request body in a JSON RPC 2.0 method call.

* core:websocket: close connection after using it

* test: add tests related to WebSocket support

- test we can identify the endpoint type for WebSockets based on the URL
  supplied: `wss://` (with SSL/TLS) and `ws://` (plain text).
- test we can generate a JsonRPC 2.0 message via the new endpoint flag
  `JsonRPC`.

* core:endpoint: fix name of jsonrpc parameter

See https://en.wikipedia.org/wiki/JSON-RPC#Version_2.0

* core:websocket: fix dangling open connection on error

Move the `defer ws.Close()` to after opening the connection, so the
socket is closed also in case of errors.

* remove jsonrpc flag

* core:websocket: fix nil pointer dereference

The connection should only be closed if successfully opened.

* Move websocket function to client

* update go.mod

* Fix build errors

* Fix errors

* Update client/client.go

---------

Co-authored-by: TwiN <twin@linux.com>
2023-08-08 22:12:37 -04:00
..
ui refactor(badge): Fix formatting 2022-08-10 21:09:22 -04:00
condition_bench_test.go fix: Print response body on failure if debug is set to true 2023-03-14 20:02:31 -04:00
condition_result.go Replace - by _ in file names 2021-07-02 20:04:05 -04:00
condition_test.go fix: Print response body on failure if debug is set to true 2023-03-14 20:02:31 -04:00
condition.go fix: Print response body on failure if debug is set to true 2023-03-14 20:02:31 -04:00
dns_test.go fix: Print response body on failure if debug is set to true 2023-03-14 20:02:31 -04:00
dns.go fix: Print response body on failure if debug is set to true 2023-03-14 20:02:31 -04:00
endpoint_status_test.go Rename Service to Endpoint (#192) 2021-10-23 16:47:12 -04:00
endpoint_status.go chore: Bump module version to v5 2022-12-06 01:41:18 -05:00
endpoint_test.go feat: support monitoring WebSocket endpoints (#511) 2023-08-08 22:12:37 -04:00
endpoint.go feat: support monitoring WebSocket endpoints (#511) 2023-08-08 22:12:37 -04:00
event_test.go Add test for NewEventFromResult 2021-09-06 16:34:03 -04:00
event.go Rename Service to Endpoint (#192) 2021-10-23 16:47:12 -04:00
result_test.go Fix #123: Deduplicate result errors 2021-06-05 18:50:24 -04:00
result.go fix: Print response body on failure if debug is set to true 2023-03-14 20:02:31 -04:00
uptime.go Remove old memory uptime implementation and auto migration 2021-09-06 13:28:35 -04:00