Skip to content

Instantly share code, notes, and snippets.

@imjasonh
Created March 25, 2014 21:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save imjasonh/9771966 to your computer and use it in GitHub Desktop.
Save imjasonh/9771966 to your computer and use it in GitHub Desktop.
sockethttp.go
package sockethttp
import (
"appengine"
"appengine/socket"
"net/http"
)
// NewClient returns a new http.Client that uses the Sockets API to make requests.
func NewClient(c appengine.Context) *http.Client {
return &http.Client{
Transport: &http.Transport{
Dial: func(netw, addr string) (net.Conn, error) {
return socket.Dial(c, netw, addr)
},
},
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment