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

Function serverStructWSSections

http/codegen/websocket.go:308–327  ·  view source on GitHub ↗

serverStructWSSections return section templates that generate WebSocket related struct type definitions for the server.

(data *ServiceData)

Source from the content-addressed store, hash-verified

306// serverStructWSSections return section templates that generate WebSocket
307// related struct type definitions for the server.
308func serverStructWSSections(data *ServiceData) []*codegen.SectionTemplate {
309 var sections []*codegen.SectionTemplate
310 sections = append(sections, &codegen.SectionTemplate{
311 Name: "server-websocket-conn-configurer-struct",
312 Source: httpTemplates.Read(websocketConnConfigurerStructT),
313 Data: data,
314 FuncMap: map[string]any{"isWebSocketEndpoint": IsWebSocketEndpoint},
315 })
316 for _, e := range data.Endpoints {
317 if e.ServerWebSocket != nil {
318 sections = append(sections, &codegen.SectionTemplate{
319 Name: "server-websocket-struct-type",
320 Source: httpTemplates.Read(websocketStructTypeT),
321 Data: e.ServerWebSocket,
322 })
323 }
324 }
325
326 return sections
327}
328
329// serverWSSections returns section templates that contain server WebSocket
330// specific code for the given service.

Callers 1

websocketServerFileFunction · 0.85

Calls 1

ReadMethod · 0.45

Tested by

no test coverage detected