Andy Gilbert Posted October 1, 2020 Report Posted October 1, 2020 Paul, this is working great! And so far is faultless when doing everything locally (on my computer). The only issue I have is, accessing this from various devices On my network fails, I think it requires a secure websocket (wss), could this be an option at all? well I’m assuming it does as I can’t make connections from devices on my network, even using your website. Tested with chrome and safari. EDIT: Looks like this is a windows firewall issue after all! Thanks
Paul Henty Posted October 2, 2020 Report Posted October 2, 2020 Glad to hear its working! I will add a option for wss as it's very easy in code, but using it would require that you have an SSL certificate installed on the PC from a trusted issuing authority bound to the correct port. Paul
Firefly Posted October 2, 2020 Author Report Posted October 2, 2020 wss shouldn't be necessary - and doing the encryption will just take extra resources. Would only be for security purposes but there isn't much point when you are just on a home LAN. If it only listens on 127.0.0.1 it will only work locally, but if you select to listen on the LAN IP it works from other computers. The only problem I had was that I had to run the program as Administrator in order to be allowed to listen on the LAN IP. Can that changed? Normally you can also set a program to listen on 0.0.0.0 which means any IP can connect to it... Otherwise I'm looking forward to test this out more as soon as I get a chance!
Paul Henty Posted October 2, 2020 Report Posted October 2, 2020 Hi Firefly, Quote The only problem I had was that I had to run the program as Administrator in order to be allowed to listen on the LAN IP. Can that changed? It can't be changed from my code. It's the Windows security that's blocking it. If you don't want to run as admin you can grant permissions to your user account to use a particular URL. The only way I've found to do this is via the command line: (note you'll need to run the command line as admin, and you need use the http version of the url). Example for using 192.168.0.1 port 2048 netsh http add urlacl url=http://192.168.0.1:2048/fsuipc/ user=DOMAIN\user Your user account will be able to use the URL without running as admin. But it will also block you from using all other URLs (including localhost), unless you register them in the same way. To delete the permissions use: netsh http delete urlacl url=http://192.168.0.1:2048/fsuipc/ Paul
Firefly Posted October 6, 2020 Author Report Posted October 6, 2020 Hi Paul, I will take my words back - I think we do need an option for wss after all. If the web page we implement this on is https the browser does not allow using an insecure socket connection. I ran into this issue when trying to inject a little script into the Skyvector map to show aircraft position there... 🙂 Allan
Paul Henty Posted October 6, 2020 Report Posted October 6, 2020 Quote - I think we do need an option for wss after al No problem. I've added it to the next version. I'll likely have it released at the weekend. I'm working on payload and fuel requests at the moment. Paul
John Dowson Posted October 9, 2020 Report Posted October 9, 2020 There is now an installer ready that includes the WebSocket server + integration into FSUIPC7 (via an Add-ons menu entry). You can download from here: http://fsuipc.simflight.com/beta/Install_FSUIPC7.zip http://www.fsuipc.com/download/Install_FSUIPC7.zip There is an issue if the WebServer is already running when FSUIPC7 is started as it currently doesn't check for this. I may add this at a later date. Also, there is currently no indication if the WebSocket server is running or not (apart from entries in the log). I think I'll update the FSUIPC7 title bar to include this information at some point. Let me know if you have any issues or suggestions. John
Paul Henty Posted October 10, 2020 Report Posted October 10, 2020 Hi everyone, I've just released version 0.2.0 of the server. Changes and additions are as follows: Added option to use SSL (wss://). Requires you have an SSL certificate from a trusted issuing authority installed, and bound to the port you are using Default address for new installations is now 'localhost' rather than 127.0.0.1 Website now supports the browser's back and forward buttons Browser bookmarks will now deep-link to the selected page Added payload commands to more easily read and write payload station and fuel tank data. Paul
John Dowson Posted October 10, 2020 Report Posted October 10, 2020 2 minutes ago, Paul Henty said: I've just released version 0.2.0 of the server. Ok, thanks Paul. I'll update the installer for this version for the next release. I would appreciate some feedback on the current release though first, in case I need to make some other updates. Thanks, John
Paul Henty Posted October 10, 2020 Report Posted October 10, 2020 Hi John, I don't have MSFS so I assumed I couldn't install/start FSUIPC7, but I just found that I can. I tested with version V0.2.0 (0.1.0 threw an error on shutdown). All looks good including starting, shutting down, autostart. Thanks, Paul
John Dowson Posted October 10, 2020 Report Posted October 10, 2020 6 minutes ago, Paul Henty said: I don't have MSFS so I assumed I couldn't install/start FSUIPC7, but I just found that I can. Yes, with FSUIPC7 now being a stand-alone exe rather than a dll, you don't need to have MSFS installed to install or run FSUIPC7. But of course, doesn't normally make much sense doing this! 7 minutes ago, Paul Henty said: I tested with version V0.2.0 (0.1.0 threw an error on shutdown). All looks good including starting, shutting down, autostart. Ok, thanks, I'll update the installer to include V0.2.0 and release sometime next week...once I've updated the FSUIPC7 user manual. I'll also update the FSUIPC6 installer to include this, although I'm not sure yet if I'll add the start/stop/etc integration. I may do that at a later stage, via menu items in the P3D Add-on drop down menu entry, but that will depend if needed (i.e. requested). Regards, John 1
joeherwig Posted December 29, 2020 Report Posted December 29, 2020 Hi Paul, first of all... thanks for jumping onto the Websocket-Train. 🙂 I tried to approach something similar with https://gitlab.com/joeherwig/portable-sim-panels-fsuipc-server which is used for https://github.com/joeherwig/portable-sim-panels But It seems, i should investigate into the new Websocket-Server you provided. What is essential is that only updated data is sent to the subscribers, as registering on events of course is a performance-bottleneck if you're receiving information which you don't need, as they did not change. May i suppose, that this feature is already there? And one more suggestion... If we anyway have a "list" of FSUIPC offsets, there types and calculations... Wouldn't it be a good idea, to provide that already in the right format (JSON array), so that users can just import that without the need of fiddling around with the right types and conversions. I'm sure based on the documentation Pete and John are doing anyway, it is also possible to render it into JSON right? Thanks a lot! Joe
Paul Henty Posted December 29, 2020 Report Posted December 29, 2020 Hi Joe, Quote What is essential is that only updated data is sent to the subscribers, as registering on events of course is a performance-bottleneck if you're receiving information which you don't need, as they did not change. May i suppose, that this feature is already there? Yes. Offsets can be registered in groups. An update for the group is only sent to the client when there are changes to any of the offsets in that group. Additionally there is an option per group to only include data from offsets that have changed since the last update was sent. This give two methods of consuming data, one suitable for real time displays and another for event driven applications like flight logs. Quote Wouldn't it be a good idea, to provide that already in the right format (JSON array), so that users can just import that without the need of fiddling around with the right types and conversions. The types are handled (as in string, int, float etc). The unit conversions are not. That still needs to be done by the client (except for Lon and Lat which are done for you). While it's possible to add unit conversion on the server side, it's a lot of manual work given the number of offsets. In the PDF offset lists the formulas are embedded in blocks of text and are not in a standard format so it makes it difficult to pull them out programmatically. There will be helper modules added in the future (like in my .NET DLL for FSUIPC) that will make it easier to deal with certain data. The only one I've added at the moment is Payload and Fuel services. This allows reading and writing of the payload and fuel levels directly in common units (lbs/litres/gallons/kg etc). Paul
freddehboy Posted May 4, 2021 Report Posted May 4, 2021 Hi Paul Henty and John Dowson That are fantastic news since I have begin planning my annunciator implementation of my own design cockpit of the 737. I have bought Prosim 737 and I am needing somwhere to read and see which annnuciatorn wich is active .... . My idea now is having a simple monitor running a Desktop app connected to a node server which will listen for offsett from FSUIPC Webbsocket? If I am not all wrong I think the webbsocket is implemented in FSUIPC7 for FS2020 🙂 Best regards Fredrik Hjärpe
John Dowson Posted May 4, 2021 Report Posted May 4, 2021 6 minutes ago, freddehboy said: If I am not all wrong I think the webbsocket is implemented in FSUIPC7 for FS2020 🙂 Yes, Paul Henty's WebSocket server has been integrated into FSUIPC7 and available via the FSUIPC7 installer. Details on the server can be found here: http://fsuipcwebsockets.paulhenty.com/ 1
Firefly Posted June 17, 2021 Author Report Posted June 17, 2021 @Paul Henty Is there a way I can send a control like I can do in the FSUIPC UI (eg. 66241 - TOGGLE_MASTER_BATTERY) through your websocket server? Also, regarding Lvars - I guess I should be able to read/write those with the new FSUIPC 7.2 by configuring them in the .ini file? Greetings, Allan
Paul Henty Posted June 18, 2021 Report Posted June 18, 2021 Quote Is there a way I can send a control like I can do in the FSUIPC UI Yes you can create 2 offsets (best done in a separate declare request). They must be in this order: 0x3114 - uint 4 - Parameter 0x3110 - uint 4 - Control In the offfset.write request, set your control number (e.g. 66241) and any parameter. (set 0 if there is no parameter like for TOGGLE_MASTER_BATTERY). Quote I guess I should be able to read/write those with the new FSUIPC 7.2 by configuring them in the .ini file? Yes, I think you assign them to free offsets and then use the offsets and normal. For FSUIPC4,5 and 6 I would need to update the websocket server for LVars as the offset trick is not available for those version. Paul 1
Manuel Lence Posted June 28, 2021 Report Posted June 28, 2021 (edited) Hi, my name is Manuel. First of all I want to congratulate you for the incredible work you are doing. I am doing an ACARS for a virtual airline. Everything in JS. My question is the following: Is there a way to send two commands at the same time? I explain. I am already using the command: offset.declare and as explained by Paul's website, I send all the offset I need to track. But I would like to also be able to send the command payload.read since it gives all the information ready to read without the need to do calculations and conversions. I already tried sending the two commands separately and joining them on the switch as explained in the documentation on the web. The problem is that when reading the payload it disconnects from the websocket and I need to keep tracking the rest of the parameters. I hope you can help me with this if possible. Thank you very much again and sorry if my English is bad I am using google translator. Edited June 28, 2021 by Manuel Lence
Paul Henty Posted June 29, 2021 Report Posted June 29, 2021 Hi Manuel, Quote The problem is that when reading the payload it disconnects from the websocket The server doesn't close the socket after a single request. It remains open for multiple requests until you close it. If you're seeing the socket being closed then it's probably your code that's closing it unintentionally. Look for places in your code that you calling ws.close(). Check that this isn't being called by mistake when your handling the response from the server. (e.g. is a case statement falling through with no 'break'?) It might help if you post your code so I can try it here. Paul
Manuel Lence Posted June 29, 2021 Report Posted June 29, 2021 (edited) Hi Paul, thanks for answering. The ws.close () is only executed with the finish button. I'm sure of that because if I send a single command it still works. I show you the part of the code: ws.onmessage = function (msg) { var response = JSON.parse(msg.data); if (response.success) { if(response.name == 'myOffsets') { showOffsetValues(response); } else if(response.name == 'myPayload') { showPayloadValues(response); } } }; And this is where I declare the offset I need and send to the websocket: this.iniciar = function () { var data = { command: 'offsets.declare', name: 'myOffsets', offsets: [{...CODE...} ] } ws.send(JSON.stringify(data)); var request = { command: 'offsets.read', name: 'myOffsets', interval: 1000 } ws.send(JSON.stringify(request)); var PayloadSend = { command: 'payload.read', name: 'myPayload', weightUnit: 'Kg', volumeUnit: 'l' } ws.send(JSON.stringify(PayloadSend)); } Thanks for your time. Edited June 29, 2021 by Manuel Lence
Paul Henty Posted June 29, 2021 Report Posted June 29, 2021 Okay. It sounds like there might be a problem in the server code. I'll run this tomorrow and see if I can reproduce the disconnection. Paul
Manuel Lence Posted June 29, 2021 Report Posted June 29, 2021 Hello Paul, the problem was solved. By removing the switch and validated with an IF, it is solved. Thank you very much and I hope you continue giving support to this server is a good job. Manuel.
Paul Henty Posted June 29, 2021 Report Posted June 29, 2021 Great, thanks for letting me know. Yes I'll continue to support this. It's good to know people are using it and finding it useful. Paul
Firefly Posted August 31, 2021 Author Report Posted August 31, 2021 Hi Paul So above you mentioned how to send controls and also deal with L:Vars. So now the inevitable question comes - how can I activate H:Vars? They are not assigned to an offset. I don't see much in the manual for advanced users on how to use the H:Vars... I don't yet have a use for it yet but just wondering about even executing Calculator Code in the WASM module?! Is that something that could be dealt with if needed? -Allan
Paul Henty Posted September 1, 2021 Report Posted September 1, 2021 Hi Allan, I think the only way to set HVars is via the WASM module, so it wouldn't be possible with the SocketServer at the moment. My FSUIPCClient DLL (used by the socket server) now has support for accessing LVars/HVars directly from the WASM module. It seems to be stable now so next week I will expose this via the Socket Server. This will mean you won't need to assign LVars to offsets anymore. You'll have direct access to them with something like "lvar.request". You'll also be able to set HVars and execute calculator code. This will only be for MSFS/FSUIPC7. Paul
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now