Atmosphere - Need to modify ws URL before connection

555 views Asked by At

I need to modify the ws url before it establishes a websocket connection.

I'm using @ManagedService in the server code and subscribing from client side using $.atmosphere.subscribe(request).

I've the following setup:

Cyberoam firewall --> Apache httpd(mod_proxy_ajp,mod_jk for load balancing) --> Glassfish

Primary Transport --> WebSocket
Fallback Transport --> long-polling

Problem I'm facing: The Cyberoam firewall is having a limitation (in WAF) that the max characters in GET URL cannot exceeds 50 chars. But when I hit the subscribe in atmosphere, it is constructing the URL with all the X-Atmosphere-.. params along with it.

For e.g ws://localhost:8080/chat?X-Atmosphere-tracking-id=5ebed4c5-0b90-4166-88b2-9f273719ab75&X-Atmosphere-Framework=2.2.1-jquery&X-Atmosphere-Transport=websocket&Content-Type=application/json&X-atmo-protocol=true") which clearly exceeds the allowable limits.

I just need to know whether I can somehow construct the URL in my server code appending all the necessary headers and params before it connects?

Yes, I have set the attachHeadersAsQueryString:false while making the initial request, and obviously it doesn't connect with missing headers information while doing a WebSocket connection.

Any suggestions/thoughts would be greatly appreciated. Thank You.

1

There are 1 answers

2
jfarcand On BEST ANSWER

Use request.attachHeadersAsQueryString = false so mo query string will be passed. You may need to upgrade to the latest version of Javascript

https://github.com/Atmosphere/atmosphere-javascript

-- Jeanfrancois (Atmosphere's lead)