aboutsummaryrefslogtreecommitdiff
path: root/example/example.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-04-09 19:40:11 +0700
committerShulhan <ms@kilabit.info>2021-04-09 19:40:11 +0700
commiteb2dbaf27910f968f21c178929d056b64e9f242c (patch)
tree9222d888921f9bdb2c18e3060e180cb17b2bbb98 /example/example.go
parent1eb00b560734683315dabbf906123aae8358e9bf (diff)
downloadgorankusu-eb2dbaf27910f968f21c178929d056b64e9f242c.tar.xz
all: change the WebSocket run return type to interface{}
Instead of []byte, the call to Run on WebSocketTarget can return anything, since we will wrap it inside the EndpointRequest.Data later.
Diffstat (limited to 'example/example.go')
-rw-r--r--example/example.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/example/example.go b/example/example.go
index cbdb840..6cc6e78 100644
--- a/example/example.go
+++ b/example/example.go
@@ -366,13 +366,13 @@ func (ex *Example) handleWSExampleGet(ctx context.Context, req *websocket.Reques
return res
}
-func (ex *Example) runWebSocketGet(rr *trunks.RunRequest) (resbody []byte, err error) {
+func (ex *Example) runWebSocketGet(rr *trunks.RunRequest) (res interface{}, err error) {
var wg sync.WaitGroup
wsc := &websocket.Client{
Endpoint: "ws://" + websocketAddress,
HandleText: func(cl *websocket.Client, frame *websocket.Frame) error {
- resbody = frame.Payload()
+ res = frame.Payload()
wg.Done()
return nil
},
@@ -409,5 +409,5 @@ func (ex *Example) runWebSocketGet(rr *trunks.RunRequest) (resbody []byte, err e
_ = wsc.Close()
- return resbody, err
+ return res, nil
}