```go
import (
"log"
"net/http"
"golang.org/x/net/websocket"
)
func main() {
http.Handle("/", websocket.Handler(listener))
if err := http.ListenAndServe(":1414", nil); err != nil {
log.Println("ok")
}
}
func listener(ws *websocket.Conn) {
var err error
for {
var request string
if err = websocket.Message.Receive(ws, &request); err != nil {
log.Println("连接断开!!")
break
}
log.Println("客户端请求 : " + request)
}
}
```
上面的websocket 连接 在ios客户端 和web浏览器上面 连接都没有问题
但是到了,Android上就打开了连接,但是马上的断开了连接
```
09-24 14:16:00.829 8871-8871/com.jh.websoket D/de.tavendo.autobahn.WebSocketConnection: opening handshake received
09-24 14:16:00.829 8871-8871/com.jh.websoket I/fajflajflajflaj: onOpen:
09-24 14:16:00.829 8871-8871/com.jh.websoket D/de.tavendo.autobahn.WebSocketConnection: fail connection [code = 3, reason = WebSockets connection lost
09-24 14:16:00.829 8871-8871/com.jh.websoket D/de.tavendo.autobahn.WebSocketReader: quit
09-24 14:16:00.830 8871-8942/com.jh.websoket D/de.tavendo.autobahn.WebSocketWriter: ended
09-24 14:16:00.831 8871-8871/com.jh.websoket I/fajflajflajflaj: onClose: 3|WebSockets connection lost
09-24 14:16:00.832 8871-8871/com.jh.websoket D/de.tavendo.autobahn.WebSocketConnection: worker threads stopped
```
上面是报错信息
请问,我哪里做错了吗
有疑问加站长微信联系(非本文作者)