summaryrefslogtreecommitdiff
path: root/tools/websocket.go
diff options
context:
space:
mode:
Diffstat (limited to 'tools/websocket.go')
-rw-r--r--tools/websocket.go36
1 files changed, 33 insertions, 3 deletions
diff --git a/tools/websocket.go b/tools/websocket.go
index 594cb1b..af23959 100644
--- a/tools/websocket.go
+++ b/tools/websocket.go
@@ -16,6 +16,7 @@ import (
"os/signal"
"strings"
"syscall"
+ "time"
"github.com/gorilla/websocket"
)
@@ -38,6 +39,9 @@ func main() {
go rx(c)
getConfig(c)
+ coverClose(c)
+ time.Sleep(1 * time.Second)
+ coverOpen(c)
Await(syscall.SIGTERM, syscall.SIGINT)
}
@@ -65,7 +69,7 @@ func Await(signals ...os.Signal) {
}
func getConfig(c *websocket.Conn) {
- request := `
+ tx(c, `
{
"jsonrpc":"2.0",
"id": 1,
@@ -75,9 +79,35 @@ func getConfig(c *websocket.Conn) {
"id":2
}
}
-`
+`)
+}
- tx(c, request)
+func coverClose(c *websocket.Conn) {
+ tx(c, `
+{
+ "jsonrpc":"2.0",
+ "id": 1,
+ "src":"user_1",
+ "method":"Cover.Close",
+ "params": {
+ "id":0
+ }
+}
+`)
+}
+
+func coverOpen(c *websocket.Conn) {
+ tx(c, `
+{
+ "jsonrpc":"2.0",
+ "id": 1,
+ "src":"user_1",
+ "method":"Cover.Open",
+ "params": {
+ "id":0
+ }
+}
+`)
}
func rx(c *websocket.Conn) {