Jump to content

Displaying a Websocket Message.


DoyleChris98
 Share

Recommended Posts

I have created a Websocket between my webpage and a application acting like a server on my computer.

And the program is sending data though the Websocket, but i am trying to display it.

 

When i open the page in the Chrome Developers Tools i get this.

 

{"message":"SIMCONNECT_RECV_ID_SIMOBJECT_DATA","value":{"COM1_A":128.250000,"COM1_S":128.300003,"COM2_A":127.800003,"COM2_S":127.900002,"NAV1_A":108.500000,"NAV1_S":117.199997,"NAV2_A":110.599998,"NAV2_S":116.800003,"ADF1_A":284.000000,"ADF2_A":240.000000,"XPDR_A":4608}}

 

Now im trying to figure out how to display the data into a div on my webpage.

The old way i was displaying it was this way.

 

Javascript

jqXHR = $.getJSON("http://" + location.hostname + "/add_definition?definition_name=RADIO&name=COM1_A&PropertyName=COM ACTIVE FREQUENCY:1&UnitName=MHz&DatumType=FLOAT32", function(dane) {});jqXHR = $.getJSON("http://" + location.hostname + "/get?definition_name=RADIO", function(data){definition_data = data;});if (definition_data == undefined)return;var C1A = document.getElementById("COM1A");C1A.innerHTML = definition_data.COM1_A.toFixed(3);

HTML

<div class="DISP1" id="COM1A" type="button" name="COM1A" onclick="SETFREQ('com1_swap',1)">XXX.XXX</div>

Im not sure how to display the data from the message into my page to display.

post-179939-0-18007700-1425847467_thumb.jpg

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...