|
|
@ -3,6 +3,7 @@ package nhooyrioWebsocketAddons |
|
|
|
import ( |
|
|
|
"context" |
|
|
|
"encoding/json" |
|
|
|
"fmt" |
|
|
|
|
|
|
|
"nhooyr.io/websocket" |
|
|
|
"nhooyr.io/websocket/wsjson" |
|
|
@ -101,6 +102,7 @@ func (r *GosmBuffer) WsCommunicator(method string, ctx context.Context, conn *we |
|
|
|
|
|
|
|
//WsCommunicator sends and receivs data to/from websocket partner
|
|
|
|
func (r *GosmContainer) WsCommunicator(method string, ctx context.Context, conn *websocket.Conn, dosth ...func(interface{}) interface{}) (error, websocket.MessageType) { |
|
|
|
fmt.Println(*r) |
|
|
|
switch { |
|
|
|
case (method == "sendtext" || method == "sendbinary" || method == "send") && len(dosth) == 0: |
|
|
|
err, receiveval := WsjsonSend(ctx, conn, *r) |
|
|
@ -117,6 +119,7 @@ func (r *GosmContainer) WsCommunicator(method string, ctx context.Context, conn |
|
|
|
|
|
|
|
//WsCommunicator sends and receivs data to/from websocket partner
|
|
|
|
func (r *GosmBuffer) WsCommunicator(method string, ctx context.Context, conn *websocket.Conn, dosth ...func(interface{}) interface{}) (error, websocket.MessageType) { |
|
|
|
fmt.Println(*r) |
|
|
|
switch { |
|
|
|
case (method == "sendtext" || method == "send") && len(dosth) == 0: |
|
|
|
err, receiveval := WsSend(ctx, conn, *r, websocket.MessageText) |
|
|
|