Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I add request parameter to SockJs constructor so that it can be send to server

I initialize my SockJs URL as

var protocols = ['xhr-polling', 'xdr-polling',  'xdr-streaming', 'xhr-streaming'];
var options = {protocols_whitelist: protocols, debug: true,server:tets};
_ws = new SockJS(url, null, options);

I want to send out a request parameter , for example somesite/sockjs/info?someparam=tets"

Is it possible? Documentation of SockJs refers that options is map which can have key value but i am not sure what key to use here.

I verified URL at server which SockJs sends over and it is

http://http_backend/cecobrowsega-3.0.0.0.31/sockjs/testapp/620/4ydem52f/xhr?null 

So in absence of request param its appending a null, seems there is a way to send over request param!

like image 738
cpandey05 Avatar asked Sep 10 '25 01:09

cpandey05


1 Answers

It's available in latest sock js client. Discussion here https://github.com/sockjs/sockjs-client/issues/72

we can pass query string along with the connection URL, same syntax as for any HTTP call

like image 93
cpandey05 Avatar answered Sep 16 '25 02:09

cpandey05