Jump to content
The simFlight Network Forums

ciccio85

new Members
  • Posts

    3
  • Joined

  • Last visited

  • Days Won

    2

ciccio85 last won the day on February 5 2023

ciccio85 had the most liked content!

Profile Information

  • Gender
    Male
  • Location
    Squillace (CZ)

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

ciccio85's Achievements

Rookie

Rookie (2/14)

  • First Post Rare
  • Week One Done Rare
  • One Month Later Rare
  • One Year In Rare

Recent Badges

2

Reputation

  1. I have a complete working example that can be used to get the data using Python 3: import websocket import _thread import json import time import rel def on_message(ws, message): print(message) def on_error(ws, error): print(error) def on_close(ws, close_status_code, close_msg): print("### closed ###") def on_open(ws): print("Opened connection") request = { "command": "about.read", "name": "about" } request2 = { "command": "offsets.declare", "name": "myOffsets", "offsets": [ {"name": "altitude", "address": 0x0570, "type": "int", "size": 8}, {"name": "avionicsMaster", "address": 0x2E80, "type": "uint", "size": 4}, {"name": "heading", "address": 0x0580, "type": "uint", "size": 4}, {"name": "aircraftName", "address": 0x3D00, "type": "string", "size": 256} ] } request3 = { "command": 'offsets.read', "name": "myOffsets", "interval": 100 } if __name__ == "__main__": ws = websocket.WebSocketApp("ws://MYIP:PORT/fsuipc/", subprotocols=["fsuipc"], on_open=on_open, on_message=on_message, on_error=on_error, on_close=on_close) ws.run_forever(dispatcher=rel, reconnect=5) ws.send(json.dumps(request)) ws.send(json.dumps(request2)) ws.send(json.dumps(request3)) rel.signal(2, rel.abort) # Keyboard Interrupt rel.dispatch()
  2. Hello, the trick was to add the fsuipc protocol. Here the working script: import json import websocket from websocket import create_connection websocket.enableTrace(True) ws = create_connection("ws://MYIP/fsuipc/", subprotocols=["fsuipc"]) ws.send(json.dumps({"command":"about.read", "name":"about"})) result = ws.recv() print (result) ws.close()
  3. Hello. Any idea on how to achieve a client using python? I tried a simple script but it does not work: import json import websocket from websocket import create_connection websocket.enableTrace(True) ws = create_connection("ws://MYIP:8384/fsuipc/") ws.send(json.dumps({"command":"about.read", "name":"about"})) result = ws.recv() print (result) ws.close() If I try that I get this response: --- request header --- GET /fsuipc/ HTTP/1.1 Upgrade: websocket Host: MYIP:8384 Origin: MYIP:8384 Sec-WebSocket-Key: nMbaFYGREah5M2uVaWU/nA== Sec-WebSocket-Version: 13 Connection: Upgrade ----------------------- --- response header --- Any suggestion? Thank you Francesco
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.