MCPcopy Create free account
hub / github.com/goadesign/goa / isJSONRPCSSE

Function isJSONRPCSSE

codegen/service/service.go:410–425  ·  view source on GitHub ↗

isJSONRPCSSE returns true if the service uses SSE for JSON-RPC streaming. This requires checking the HTTP endpoints in the root expression.

(sd *ServicesData, svc *expr.ServiceExpr)

Source from the content-addressed store, hash-verified

408// isJSONRPCSSE returns true if the service uses SSE for JSON-RPC streaming.
409// This requires checking the HTTP endpoints in the root expression.
410func isJSONRPCSSE(sd *ServicesData, svc *expr.ServiceExpr) bool {
411 // Check if service has JSON-RPC
412 httpSvc := sd.Root.API.JSONRPC.HTTPExpr.Service(svc.Name)
413 if httpSvc == nil {
414 return false
415 }
416
417 // Check if any JSON-RPC streaming endpoint uses SSE
418 for _, e := range httpSvc.HTTPEndpoints {
419 if e.MethodExpr.IsStreaming() && e.IsJSONRPC() && e.SSE != nil {
420 return true
421 }
422 }
423
424 return false
425}
426
427// streamInterfaceFor builds the data to generate the client and server stream
428// interfaces for the given endpoint.

Callers 3

FilesFunction · 0.85
exampleServiceFileFunction · 0.85
EndpointFileFunction · 0.85

Calls 3

IsJSONRPCMethod · 0.80
ServiceMethod · 0.65
IsStreamingMethod · 0.45

Tested by

no test coverage detected