0
我有以下问题:从python脚本将数据发送到服务器socket.io
我哈瓦Python脚本和我的机器上运行的服务器socket.io。 现在,我想将Python脚本中的数据传递给服务器和客户端。 目前,我使用了以下内容:
服务器:
fs.watchFile('position.txt', function (curr, prev) {
//console.log('the current mtime is: ' + curr.mtime);
//console.log('the previous mtime was: ' + prev.mtime);
io.emit('positionswechsel', curr.mtime); //need the content of the file here
});
的Python:
def my_callback2(channel):
fout=open("../sio/position.txt","w")
fout.write("P1")
fout.close()
print "falling edge detected on 18"
在此方案中,我看到了事件之间有非常高的延迟(写文件)和我的服务器的反应。
现在,我认为应该有一种方法可以直接将信息从python脚本传递到服务器/客户端(我想查看网页上的更改)。
严任何人请帮助我吗?
Yannic
嗨,谢谢。 不幸的是,我无法安装客户端。任何人都可以帮忙吗? – fidgol