Add custom data to init method

Hi! I have a shiny server-client application, which is receive/send data from/to server using web sockets. Now I want to emulate connection to an application from another client. To do this I create a page with javascript

<script src="/sock/jquery.min.js"></script>
<script src="/sock/shiny.min.js"></script>
<script src="/sock/sockjs-0.3.4.min.js"></script>
<script src="/sock/shiny-server-client.min.js"></script>
<script>preShinyInit({ reconnect: true, disableProtocols: [] });</script>

At the first time another client sends data via web socket

["1#0|m|{\"method\":\"init\",\"data\":{\".clientdata_pixelratio\":1,\".clientdata_url_protocol\":\"http:\",\".clientdata_url_hostname\":\"salesbox\",\".clientdata_url_port\":\"\",\".clientdata_url_pathname\":\"/sock/\",\".clientdata_url_search\":\"\",\".clientdata_url_hash_initial\":\"\",\".clientdata_url_hash\":\"\",\".clientdata_singletons\":\"\"}}"]

But shiny application send

["1#0|m|{\"method\":\"init\",\"data\":{\"optsTabset\":\"Strategy\",\"generate:shiny.action\":0,\"note\":\" \",\"strategy\":\"CapPro\",\"paths\":\"1000\",\"ul\":[],\"start_date:shiny.date\":\"2021-02-16\",\"adjust_mean\":false,\"rhp:shiny.number\":5,\"fix_cpn:shiny.number\":0,\"hist_depth:shiny.number\":5,\".clientdata_output_scenarios_plot_width\":500,\".clientdata_output_scenarios_plot_height\":400,\".clientdata_output_scenarios_plot_bg\":\"rgb(255, 255, 255)\",\".clientdata_output_scenarios_plot_fg\":\"rgb(51, 51, 51)\",\".clientdata_output_scenarios_plot_accent\":\"rgb(51, 122, 183)\",\".clientdata_output_scenarios_plot_font\":{\"families\":[\"Helvetica Neue\",\"Helvetica\",\"Arial\",\"sans-serif\"],\"size\":\"14px\"},\".clientdata_output_strat_params_hidden\":false,\".clientdata_output_downloadData_hidden\":false,\".clientdata_output_scenarios_plot_hidden\":false,\".clientdata_output_scenarios_table_hidden\":false,\".clientdata_output_distrib_table_hidden\":false,\".clientdata_output_generated_hidden\":false,\".clientdata_pixelratio\":1,\".clientdata_url_protocol\":\"http:\",\".clientdata_url_hostname\":\"10.56.154.141\",\".clientdata_url_port\":\"\",\".clientdata_url_pathname\":\"/scenarios/\",\".clientdata_url_search\":\"\",\".clientdata_url_hash_initial\":\"\",\".clientdata_url_hash\":\"\",\".clientdata_singletons\":\"\"}}"] 

As you see some init data are apply to init method.

How to add some init data to init method?

Thank you in advance!

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.