-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
websocket4net connect to Java Spring WebSocket server #111
Comments
I suspect that the Open() method needs to support STOMP's connect frame. But could not figure out a way to pass the frame to Open() method. |
Sorry, Kerry. I mistyped your name to Jerry in my initial message. Please advise. Thanks |
Could you show me the handshake header the Spring WebSocket server required? |
Kerry, Sorry, it took me a couple of days to get back to you. The following is the capture of the "GET /cadrs/v1/websocket/infor HTTP/1.1" request. Please let me know if this is what you are looking for: Frame 22: 239 bytes on wire (1912 bits), 239 bytes captured (1912 bits) on interface 6 |
It doesn't like a websocket request's information. |
and the [Full request URL: http://10.10.21.208:8080/cadrs/v1/websocket/info] has information of: {"entropy":-1545485823,"origins":[":"],"cookie_needed":true,"websocket":true} |
Following by this frame: Frame 28: 275 bytes on wire (2200 bits), 275 bytes captured (2200 bits) on interface 6 and the [Full request URI:....] has content of "Can "Upgrade" only to "WebSocket"." |
You can use Fiddler instead to capture the raw communication. It still doesn't seem right:
|
I will try Fiddler and let you know what I get. Thanks |
Hi Kerry, Please see attached for the Fiddler capture. Also, app.zip is the main test client code I used. Thanks |
Hi Kerry, Please advise if my latest capture included information that you were looking for. Thanks |
From the bottom of the screenshot, the server is the RabbitMQ? |
Yea, it is not really intuitive. RabbitMQ really serves as a full function StompBrokerRelay component in the Spring WebSocket solution. From a client point of view, it talks to a websocket server with STOMP subprotocol. https://www.youtube.com/watch?v=mmIza3L64Ic&feature=c4-overview&list=UU7yfnfvEUlXUIfm8rGLwZdA Thanks |
Did you get any detailed error message you you tried to connect with WebSocket4Net? Try to trace the communication when you connect using websocket4net. |
Could you use Fiddler to track this communication either? |
Hi, Kerry, My name is Kevin Qian who is working with Jimmy on this issue. Jimmy is out of town for a week. so I can help to collect info you needed. With fiddler, I don't even see any protocol level packet (HTTP or WS triggered by my client), while I could see in Jimmy's capture when using JS client jimmy attached. what this link's shown seem matching what we see in JS client: https://tools.ietf.org/html/rfc6455#section-1.3 Regards, |
I was able to fix the issue on Open() by allowing setAllowedOrigins("") on WebSocket Server side as follows: |
If so, this issue is about origin. Anyway, you can find what is the correct origin. And set the origin by yourself by the websocket constructor parameter. var websocket = new WebSocket(xxxx, orgin = "correctOrgin"); |
Thank you, that works! |
Hi, Kerry, One more question for you: Now I am able to connect our Stomp Websocket Server. However, the server will close the endpoint at 30 seconds after the connection is established because the server has heartbeat enabled. Does WebSocket4Net have a way for user to turn on heartbeat? I see that user can set values for EnableAutoSendPing and AutoSendPingInterval. what are the use of these attributes? are they related to heartbeat? Do you have a heartbeat implementation example for a websocket client? Regards, |
Which kind heartbeat does it want? If it is just websocket ping/pong, I think websocket4net already enable it by default. But if it requires some kind application level heart beat, you just need send the the keep alive message following their protocol. |
Hi Jerry,
Is there any way that the client can connect to Spring WebSocket server?
When I tried with a client instantiated through WebSocket(host, subprotocol, version) { I tried both an empty string and "STOMP" as subprotocol), the client state always transitioned to "Connecting", then "Close".
Thanks
Jimmy
The text was updated successfully, but these errors were encountered: