Websocket Errors when Sleep is Removed

#1

I’m setting up a python client that watches for special json files to be dropped into a directory, then it shoots the call to the javascript client through crossbar, which handles the request to display the data in a Cesium.js client.

The problem I’m trying to solve is to allow interactive and blocking use of the cesium client from other languages (matlab, python). I couldn’t get a single function call to work, because you can’t restart the reactor from the python interactive console (ipython), and the matlab-python bridge they have implemented requires you to restart matlab to perform the equivalent of restarting the python interpreter. So, it seemed like the next best thing was to serialize the request to json, then have a python client grab the request, and send it to the cesium client.

This works ok with a little bit of careful consideration due to having to write files to disk. However, I’ve messed around with removing the sleep from the while True loop for the python client watching for files, and ran into issues.

If I run through a loop (in python or matlab) that requests cesium to add a point at some latitude/longitude, this results is processing a lot of json files pretty quickly. Without the sleep(1), the cesium client ends up dropping the connection with one of two errors:

  1. WebSocket connection to ‘ws://127.0.0.1:8080/ws’ failed: Invalid frame header

  2. Something about decoding ‘UTF8’

Any ideas on what would cause this?

0 Likes