Listening for TCP messages containing JSON to update worksheet
Open the Resolver document. See how it contains usercode to create a new (cache) worksheet to recieve the incoming data. Switch to this sheet, if it isn't already the current. More usercode uses the code in server.py to create a TCP server, listening for messages on localhost port 9999. You should see some diagnostic text in the output pane reading: listening on localhost:9999... ok (you might have to scroll up to see it) Now, open a command-line window and cd to the directory of these files. Type the command: python send-test-data.py < some-json.txt This will send the JSON in the text file as a TCP message to localhost on port 9999. The JSON message is recieved by the TCP server, which passes the message to the function 'handler' in the Resolver document usercode. This function does a quick and dirty conversion of JSON into Python data, and uses that data to populate some cells in the cache worksheet. If you click on the grid (ie. not on the code pane) then recalcs will |
This model has been created for Resolver One, an advanced spreadsheet. You can download Resolver One here. |
