drlu11748
drlu11748
2015-07-23 08:00

如何在Go中获取socket.io握手查询

已采纳

We use the go-socket.io package to run a socket server and we need to authenticate users with handshake query data. In node.js we used code like:

authDataString = socket.handshake.query.authData;

and we need to do something similar in Go.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • douke3007 douke3007 6年前

    You can use the Request field of a socket to get query parameters from the request URL using FormValue:

        log.Print(socket.Request().FormValue("foo"))
    
    点赞 评论 复制链接分享

相关推荐