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

Commit

Permalink
Merge pull request #892 from gobuffalo/deprecate-websocket
Browse files Browse the repository at this point in the history
deprecated Websocket on the context
  • Loading branch information
markbates authored Jan 31, 2018
2 parents f4ab98b + 471b79f commit 2ba96a4
Showing 1 changed file with 7 additions and 2 deletions.
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

0 comments on commit 2ba96a4

Please sign in to comment.