Browse Source

WsCommunicater liefert testweise nur Println

Sackgasse,-später-evtl.-weitermachen
Klaus Wendel 2 years ago
parent
commit
bd9bd74a80
  1. 34
      nhooyrioWebsocketAddons/nhooyrioWebsocketAddons.go

34
nhooyrioWebsocketAddons/nhooyrioWebsocketAddons.go

@ -102,22 +102,24 @@ 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.Print("ICH BIN HIER UND HIER GEHT WAS SCHIEF 0")
switch {
case (method == "sendtext" || method == "sendbinary" || method == "send") && len(dosth) == 0:
err, receiveval := WsjsonSend(ctx, conn, *r)
*r = receiveval.(GosmContainer)
return err, websocket.MessageText
case method == "receive": // && len(dosth) == 1:
fmt.Print("ICH BIN HIER UND HIER GEHT WAS SCHIEF 1")
err, receiveval := WsjsonReceive(ctx, conn, dosth[0])
fmt.Print("ICH BIN HIER UND HIER GEHT WAS SCHIEF 2")
//*r = receiveval.(GosmContainer)
_ = receiveval
return err, websocket.MessageText
default:
panic("Wrong communicator method or invalid number of dosth-functions")
}
fmt.Println("ICH BIN HIER UND HIER GEHT WAS SCHIEF 0")
/*
switch {
case (method == "sendtext" || method == "sendbinary" || method == "send") && len(dosth) == 0:
err, receiveval := WsjsonSend(ctx, conn, *r)
*r = receiveval.(GosmContainer)
return err, websocket.MessageText
case method == "receive" && len(dosth) == 1:
fmt.Print("ICH BIN HIER UND HIER GEHT WAS SCHIEF 1")
err, receiveval := WsjsonReceive(ctx, conn, dosth[0])
fmt.Print("ICH BIN HIER UND HIER GEHT WAS SCHIEF 2")
//*r = receiveval.(GosmContainer)
_ = receiveval
return err, websocket.MessageText
default:
panic("Wrong communicator method or invalid number of dosth-functions")
}
*/
}
//WsCommunicator sends and receivs data to/from websocket partner

Loading…
Cancel
Save