Documentation ¶
Overview ¶
Package ipc provides an event listeners and event emitter methods or functions for ipc(Inter-process communication) using the process `stdin` and `stdout` as it's medium.
Index ¶
- func Marshal(v interface{}) (string, error)
- type Handler
- type HandlerWithReply
- type IPC
- func (ipc IPC) On(event string, handler Handler)
- func (ipc IPC) OnReceiveAndReply(event string, handler HandlerWithReply)
- func (ipc IPC) RemoveListener(event string)
- func (ipc IPC) Reply(event string, data, err interface{})
- func (ipc IPC) Send(event string, data interface{})
- func (ipc IPC) SendAndReceive(event string, data interface{}, handler Handler)
- func (ipc IPC) Start()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶
type Handler func(data interface{})
Handler When the underline type of data is being
access through `type assertion` if the data has a literal value the underlining type will be return else a `JSON` representative of the data will be return
type HandlerWithReply ¶
type HandlerWithReply func(replyChannel string, data interface{})
HandlerWithReply When the underline type of data is being
access through `type assertion` if the data has a literal value the underlining type will be return else a `JSON` representative of the data will be return. `replyChannel` is the event name you'll pass to `ipc.Reply` method to respond to the sender
type IPC ¶
type IPC struct {
// contains filtered or unexported fields
}
IPC channel
func (IPC) OnReceiveAndReply ¶
func (ipc IPC) OnReceiveAndReply(event string, handler HandlerWithReply)
OnReceiveAndReply listen for an events and as well reply back to the same sender with the help of `ipc.Reply` method
func (IPC) RemoveListener ¶
RemoveListener remove listener
func (IPC) SendAndReceive ¶
SendAndReceive send and listen for reply event
Click to show internal directories.
Click to hide internal directories.