MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / handleSSE

Method handleSSE

controller/mcp/iml.go:179–197  ·  view source on GitHub ↗
(ctx *gin.Context, server http.Handler, sIn SessionInfo)

Source from the content-addressed store, hash-verified

177}
178
179func (i *imlMcpController) handleSSE(ctx *gin.Context, server http.Handler, sIn SessionInfo) {
180
181 writer := &ResponseWriter{
182 Writer: ctx.Writer,
183 sessionId: make(chan string),
184 }
185 defer close(writer.sessionId)
186 sessionId := ""
187 go func() {
188 var ok bool
189 sessionId, ok = <-writer.sessionId
190 if !ok {
191 return
192 }
193 i.sessionKeys.Store(sessionId, sIn)
194 }()
195 server.ServeHTTP(writer, ctx.Request)
196 i.sessionKeys.Delete(sessionId)
197}
198
199func (i *imlMcpController) GlobalHandleMessage(ctx *gin.Context) {
200 i.handleMessage(ctx, i.openSseServer)

Callers 3

AppHandleSSEMethod · 0.95
GlobalHandleSSEMethod · 0.95
ServiceHandleSSEMethod · 0.95

Calls 2

DeleteMethod · 0.65
ServeHTTPMethod · 0.45

Tested by

no test coverage detected