planetmint-go/x/machine/keeper/issue_response.go
Julian Strobl d4eed021c8
[go.mod] Switch module to github.com (#86)
This is the quasi-standard and fixes the error below:

```
$ go get -u github.com/planetmint/planetmint-go@v0.1.0
go: github.com/planetmint/planetmint-go@v0.1.0: parsing go.mod:
        module declares its path as: planetmint-go
                but was required as: github.com/planetmint/planetmint-go
```

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-09-21 17:37:57 +02:00

30 lines
721 B
Go

package keeper
import (
config "github.com/planetmint/planetmint-go/config"
"strconv"
"github.com/cometbft/cometbft/libs/log"
"github.com/hypebeast/go-osc/osc"
)
func (k Keeper) IssueResponseHandler(logger log.Logger) {
conf := config.GetConfig()
addr := "0.0.0.0:" + strconv.FormatInt(int64(conf.OSCServicePort), 10)
d := osc.NewStandardDispatcher()
err := d.AddMsgHandler("/rddl/resp", func(msg *osc.Message) {
logger.Info("Issue Response: " + msg.String())
})
if err != nil {
logger.Error("Unable to add handler to OSC service.")
}
server := &osc.Server{
Addr: addr,
Dispatcher: d,
}
err = server.ListenAndServe()
if err != nil {
logger.Error("Unable to start the OSC service.")
}
}