dop20345
dop20345
2016-03-29 14:34

通过消息关闭Websocket连接

  • websocket

How is it possible to close a websocket connection and pass it a message / code?

The docs only define func (ws *Conn) Close() error without any arguments

I would like to receive the event from JavaScript like this:

websocket.onclose = function(event) {
  console.log(event);
};

I am using golang.org/x/net/websocket

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答