Created
March 25, 2014 21:40
-
-
Save imjasonh/9771966 to your computer and use it in GitHub Desktop.
sockethttp.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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