MCPcopy
hub / github.com/wavetermdev/waveterm / AdaptStreamToMsgCh

Function AdaptStreamToMsgCh

pkg/wshutil/wshrpcio.go:19–23  ·  view source on GitHub ↗

special I/O wrappers for wshrpc * terminal (wrap with OSC codes) * stream (json lines) * websocket (json packets)

(input io.Reader, output chan baseds.RpcInputChType, readCallback func())

Source from the content-addressed store, hash-verified

17// * websocket (json packets)
18
19func AdaptStreamToMsgCh(input io.Reader, output chan baseds.RpcInputChType, readCallback func()) error {
20 return utilfn.StreamToLines(input, func(line []byte) {
21 output <- baseds.RpcInputChType{MsgBytes: line}
22 }, readCallback)
23}
24
25func AdaptOutputChToStream(outputCh chan []byte, output io.Writer) error {
26 drain := false

Callers 6

connectToJobManagerMethod · 0.92
handleNewListenerConnFunction · 0.92
SetupConnRpcClientFunction · 0.85
handleDomainSocketClientFunction · 0.85

Calls 1

StreamToLinesFunction · 0.92

Tested by

no test coverage detected