MCPcopy Create free account
hub / github.com/diillson/chatcli / Serve

Method Serve

cli/rpcserve/jsonrpc.go:90–105  ·  view source on GitHub ↗

Serve reads and dispatches messages until ctx is canceled or in hits EOF.

(ctx context.Context)

Source from the content-addressed store, hash-verified

88
89// Serve reads and dispatches messages until ctx is canceled or in hits EOF.
90func (s *Server) Serve(ctx context.Context) error {
91 scanner := bufio.NewScanner(s.in)
92 scanner.Buffer(make([]byte, 0, 64*1024), 8*1024*1024) // allow large payloads
93
94 for scanner.Scan() {
95 if ctx.Err() != nil {
96 return ctx.Err()
97 }
98 line := scanner.Bytes()
99 if len(line) == 0 {
100 continue
101 }
102 s.dispatch(ctx, line)
103 }
104 return scanner.Err()
105}
106
107func (s *Server) dispatch(ctx context.Context, line []byte) {
108 var req Request

Callers 7

newHubTestClientFunction · 0.95
loginAnthropicLocalhostFunction · 0.95
LoginOpenAICodexOAuthFunction · 0.95
runLinesFunction · 0.95
runRPCFunction · 0.95
TestHubGRPCEndToEndTailFunction · 0.95
StartMethod · 0.80

Calls 2

dispatchMethod · 0.95
ScanMethod · 0.80

Tested by 3

newHubTestClientFunction · 0.76
runLinesFunction · 0.76
TestHubGRPCEndToEndTailFunction · 0.76