ipc

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

README

websocket-ipc

Inter-Process Communication via websocket

how to be a deamon

install : install into service start : run as a deamon

sudo ./example install
sudo ./example start

how to stop deamon

when the deamon start

sudo ./example stop

how to remove deamon

when the deamon stop

sudo ./example remove

how to Communication

when the deamon start

sudo ./example {any string otherwise commands}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetWsPort added in v0.0.5

func GetWsPort() string

func GetWsRoute added in v0.0.5

func GetWsRoute() string

func GetWsServer added in v0.0.5

func GetWsServer() string

func SetWsPort added in v0.0.5

func SetWsPort(p int)

func SetWsRoute added in v0.0.5

func SetWsRoute(s string)

func SetWsServer added in v0.0.5

func SetWsServer(s string)

Types

type Client

type Client struct {
	Ws  *websocket.Conn
	Msg IpcCmd
}

type IPC

type IPC struct {
	WsClient chan *Client
	IPCCmd   func(client *Client) (err error)
}

func NewIpc

func NewIpc(aCmd func(client *Client) (err error), s *log.Logger, e *log.Logger) (i *IPC)

func (*IPC) ACmd

func (i *IPC) ACmd(client *Client) (err error)

ACmd : an example Cmd process function

func (*IPC) WsHandel

func (i *IPC) WsHandel()

type IpcCmd added in v0.0.2

type IpcCmd struct {
	Cmd     string `json:"cmd"`
	CmdFlag string `json:"cmd_flag"`
}

func (IpcCmd) Serialize added in v0.0.2

func (c IpcCmd) Serialize() (serialString string)

type IpcResult added in v0.0.3

type IpcResult struct {
	ReqCmd IpcCmd
	Rsp    IpcRsp
}

func SendCmd

func SendCmd(aCmd IpcCmd) (res *IpcResult, err error)

type IpcRsp added in v0.0.3

type IpcRsp struct {
	UnixTime int64  `json:"unix_time,string"`
	Result   bool   `json:"result,string"`
	Message  string `json:"msg"`
}

func (IpcRsp) Serialize added in v0.0.3

func (c IpcRsp) Serialize() (serialString string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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