MCPcopy Create free account
hub / github.com/kataras/iris / Upgrade

Function Upgrade

websocket/websocket.go:187–204  ·  view source on GitHub ↗

Upgrade upgrades the request and returns a new websocket Conn. Use `Handler` for higher-level implementation instead.

(ctx *context.Context, idGen IDGenerator, s *neffos.Server)

Source from the content-addressed store, hash-verified

185// Upgrade upgrades the request and returns a new websocket Conn.
186// Use `Handler` for higher-level implementation instead.
187func Upgrade(ctx *context.Context, idGen IDGenerator, s *neffos.Server) *neffos.Conn {
188 /* Do NOT return the error as it is captured on the OnUpgradeError listener,
189 the end-developer should not be able to write to this http client directly. */
190 ctx.DisablePoolRelease()
191
192 conn, upgradeErr := s.Upgrade(ctx.ResponseWriter(), ctx.Request(), func(socket neffos.Socket) neffos.Socket {
193 return &socketWrapper{
194 Socket: socket,
195 ctx: ctx,
196 }
197 }, wrapIDGenerator(idGen)(ctx))
198
199 if upgradeErr != nil {
200 manualReleaseWithoutResp(ctx)
201 }
202
203 return conn
204}
205
206func manualReleaseWithoutResp(ctx *context.Context) {
207 ctx.ResponseWriter().EndResponse() // relases the response writer (common, recorder & compress).

Callers 1

HandlerFunction · 0.85

Calls 5

wrapIDGeneratorFunction · 0.85
manualReleaseWithoutRespFunction · 0.85
DisablePoolReleaseMethod · 0.80
ResponseWriterMethod · 0.80
RequestMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…