gosock

module
v0.0.0-...-f884121 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2022 License: BSD-3-Clause

README

gosock

Send json command through sock in golang

Server

var sock = NewSock("test.sock")
sock.OnCommand(func(cmd *Command) {
	log.Println(cmd)
	_ = cmd.ReplyOk()
})
err := sock.Listen()
if err != nil {
	log.Fatal(err)
}

Client

var sock = NewSock("test.sock")
_, err := sock.Send(&Command{
	Code:   "stop",
	Params: map[string]interface{}{},
})
if err != nil {
	log.Fatal(err)
}

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL