Skip to content
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

info request timeout #146

Open
msaiducar opened this issue Apr 12, 2018 · 0 comments
Open

info request timeout #146

msaiducar opened this issue Apr 12, 2018 · 0 comments

Comments

@msaiducar
Copy link

Hi,

I explained the details in Stackoverflow Post [1].
I use Spring Boot 2.0.0 Release as backend, SockjsClient 1.1.4, StompJs 2.3.3.
I want to use token based (jwt) authentication while connecting to websocket. As you may know, STOMP does not support http headers, so I would like to send my token in payload. Then, I will parse the nativeHeaders of payload within my ChannelInterceptor class. However,

When STOMP tries to connect websocket, it fails and the consol output is below.

Opening Web Socket...stomp.min.js:8:1737
XHRGET http://192.168.0.58:8080/api/v3/websocket/info?t=1523523409064 [HTTP/1.1 200  14ms]
XHRGET http://192.168.0.58:8080/api/v3/websocket/181/q2ln1go4/eventsource 
XHRGET http://192.168.0.58:8080/api/v3/websocket/181/ebux3w0b/eventsource
XHRPOST http://192.168.0.58:8080/api/v3/websocket/181/s5uv2w1e/xhr?t=1523523412548
Whoops! Lost connection to http://192.168.0.58:8080/api/v3/websocket stomp.min.js:8:1737

If, I make wait 2 seconds before returning the info request on Server side, STOMP successfully connects and subscribes. The console output;

Opening Web Socket... stomp.min.js:8:1737
XHRGET http://192.168.0.58:8080/api/v3/websocket/info?t=1523523529512  [HTTP/1.1 200  2012ms]
Web Socket Opened...  stomp.min.js:8:1737
>>> CONNECT
x-auth-token:{{my_token}}
accept-version:1.1,1.0
heart-beat:0,10000
�                                                 stomp.min.js:8:1737
<<< CONNECTED
version:1.1
heart-beat:0,0
user-name:admin
�                                                  stomp.min.js:8:1737
connected to server undefined       stomp.min.js:8:1737
>>> SUBSCRIBE
id:sub-0
destination:/user/queue/admin
�

Does anyone has an idea? Also I'm wondering what is the purpose of /eventsource requests? Because, if I wait 2 seconds or not, the response of /info requests same. If server returns 10-20ms, stomp starts to make /eventsource request, however If the response of /info requests took ~2 seconds, it did not.

[1] = https://stackoverflow.com/questions/49774655/spring-security-and-websocket-with-jwt-token

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant