In trying to understand Go, I ran into this piece of code in websocket.go
(snipped):
type frameHandler interface {
HandleFrame(frame frameReader) (r frameReader, err error)
WriteClose(status int) (err error)
}
// Conn represents a WebSocket connection.
type Conn struct {
config *Config
request *http.Request
.
.
frameHandler
PayloadType byte
defaultCloseStatus int
}
In the Conn type the frameHandler
stands there all alone? An interface without a name?
Later on in the code they even try check if the poor interface is nil:
Conn(a).frameHandler == nil
My own guess is that the frameHandler
within the struct is a type which matches the frameHandler interface, and on top of that will have the name frameHandler
. Is this correct? Hehe, fun language anyhow.