简体   繁体   English

在nkzawa socket.iO客户端上添加自定义参数进行握手

[英]Add custom params on nkzawa socket.iO-client for the handshake

I want to be able to add custom params in the client for the handshake. 我希望能够在客户端中为握手添加自定义参数。

In the html client I am doing this 在html客户端中,我正在执行此操作

var socket = io('http://192.168.1.120:3000/socket', {query: user});

where user is an json object with data 用户是带有数据的json对象

I want to be able to do the same in java, I am using the library nkzawa socket.io-client 我希望能够在Java中执行相同操作,我正在使用库nkzawa socket.io-client

Thank you 谢谢

@nkzawa replied me in the repository @nkzawa在存储库中回复了我

https://github.com/nkzawa/socket.io-client.java/issues/33 https://github.com/nkzawa/socket.io-client.java/issues/33

I just need to add the parameters to the URL 我只需要将参数添加到URL

IO.socket("http://SERVER_URL:3000/socket?userid=100");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Socket.io-client 中发送自定义 header - Send custom header in Socket.io-client socket.io-client java没有连接到服务器 - socket.io-client java not connecting to server 我无法使用Socket.IO-client Java连接到服务器 - I can not connect to server with Socket.IO-client Java 套接字 io android 作为客户端握手失败 - Socket io android handshake failed as client socket.io客户端与socket.io服务器0.9.6的连接问题 - Connection problems with the socket.io-client to socket.io server 0.9.6 未收到 Angular 8 socket.io-client 2.2.0 和 Java netty-socket.io 消息? - Angular 8 socket.io-client 2.2.0 and Java netty-socket.io message not being received? nkzawa socket.io java客户端连接在两个socketio服务器前面击中haproxy(loadbalancer)时没有升级到websocket - nkzawa socket.io java client connection not upgrading to websocket when hitting haproxy(loadbalancer) in front of two socketio servers 如何使用 Socket.IO-client Java 从 Android 向服务器发送 String 消息? - How send String message to server from Android with Socket.IO-client Java? 如何在 eclipse exp 项目上运行 gradle 项目:https://github.com/nkzawa/socket.io-android-chat - How to run a gradle project on eclipse exp project: https://github.com/nkzawa/socket.io-android-chat socket.io-java-client cookie /自定义标头 - socket.io-java-client cookies / custom headers
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM