如何在打开连接时从Javascript发送一些额外的数据,比如用户名或时间?在
conn = new SockJS('http://' + window.location.host + '/chat', 'websocket');
我也试过了
^{pr2}$服务器上的Python/Tornado-side函数
class ChatConnection(sockjs.tornado.SockJSConnection):
def on_open(self, info):
# some code to broadcast data, but info is empty in both cases
pass
在连接时不能这样做,但可以在以后发送身份验证。在
看这里:Can I use query string parameters or cookies to pass data to the server?
相关问题 更多 >
编程相关推荐