Hi,
I am running a C++ process and I want to display its output with a bokeh server application.
Ideally, the C++ program would run during the day while sending the updates to the bokeh server. Then, the (bokeh) server sends the data to the client.
My options so far are as follows:
1 [Bad Idea] - After a number of events the c++ program fetch a buffer to a csv file. On the next periodic_callback the bokeh server sees the changes and updates the client.
2 [Ok Idea] - Using ZeroMQ, every second the Bokeh serves asks the c++ program if there is any update. If there is, bokeh server sends to the client.
The idea 2 looks like this:
Bokeh server:
source = some_data
def update_client(new_data):
source.stream(new_data, 100)
#Open ZeroMQ connection:
context = zmq.Context()
socket = context.socket(zmq.REQ)
ip = ‘localhost’
socket.connect(“tcp://”+ip+":5555")
def ask_mzq():
message = socket.recv()
if message is not None:
update_client(message)
#Add a figure to the app
plot = figure()
plot.circle(source=source, x=‘x’, y=‘y’)
curdoc().add_root(plot)
curdoc().add_periodic_callback(ask_mzq, 1000)
QUESTIONS:
-
Does bokeh has something pre-built for this sort of task?
-
What would be the most appropriate data structure to send string-like data from a buffer to Python.
This correspondence (including any attachments) is for the intended recipient(s) only. It may contain confidential or privileged information or both. No confidentiality or privilege is waived or lost by any mis-transmission. If you receive this correspondence by mistake, please contact the sender immediately, delete this correspondence (and all attachments) and destroy any hard copies. You must not use, disclose, copy, distribute or rely on any part of this correspondence (including any attachments) if you are not the intended recipient(s).本メッセージに記載および添付されている情報(以下、総称して「本情報」といいます。)は、本来の受信者による使用のみを意図しています。誤送信等により本情報を取得された場合でも、本情報に係る秘密、または法律上の秘匿特権が失われるものではありません。本電子メールを受取られた方が、本来の受信者ではない場合には、本情報及びそのコピーすべてを削除・破棄し、本電子メールが誤って届いた旨を発信者宛てにご通知下さいますようお願いします。本情報の閲覧、発信または本情報に基づくいかなる行為も明確に禁止されていることをご了承ください。

