drlu11748 2015-07-23 08:00
浏览 124
已采纳

如何在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 2015-07-23 09:10
    关注

    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"))
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?