Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

deprecated Websocket on the context #892

Merged
merged 2 commits into from
Jan 31, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions default_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"net/http"
"net/url"
"runtime"
"sort"
"strings"
"time"
Expand Down Expand Up @@ -165,9 +166,13 @@ func (d *DefaultContext) Error(status int, err error) error {
return HTTPError{Status: status, Cause: errors.WithStack(err)}
}

// Websocket returns an upgraded github.com/gorilla/websocket.Conn
// that can then be used to work with websockets easily.
// Websocket is deprecated, and will be removed in v0.12.0. Use github.com/gorilla/websocket directly instead.
func (d *DefaultContext) Websocket() (*websocket.Conn, error) {
warningMsg := "Websocket is deprecated, and will be removed in v0.12.0. Use github.com/gorilla/websocket directly instead."
_, file, no, ok := runtime.Caller(1)
if ok {
warningMsg = fmt.Sprintf("%s Called from %s:%d", warningMsg, file, no)
}
return defaultUpgrader.Upgrade(d.Response(), d.Request(), nil)
}

Expand Down