简体   繁体   English

从python发送套接字到Meteor(node.js)

[英]Send socket from python to Meteor (node.js)

I want to send a socket with data (just an integer like "23") from python to a web app that is written using Meteor which is a web framework built on top of node.js and other libraries. 我想从python发送一个包含数据的套接字(只是一个像“23”这样的整数)到一个使用Meteor编写的Web应用程序, Meteor是一个构建在node.js和其他库之上的Web框架。

On python side i have the following code: 在python方面,我有以下代码:

import serial, socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

s.connect(("localhost", 3000))
s.send ('something')

What do I have to do on Meteor side? 我在Meteor方面要做什么? Is this python code correct? 这个python代码是否正确? Is this different from websockets? 这与websockets不同吗?

Meteor uses the DDP protocol to communicate, so you would have to write a DDP client for Python and either CALL a remote Meteor method or SUB to a published channel. Meteor使用DDP协议进行通信,因此您必须为Python编写DDP客户端,并将远程Meteor方法或SUB调用到已发布的通道。

Some initial work on a python DDP client has been done, but not finished, here: https://github.com/meteor/meteor/blob/master/examples/unfinished/python-ddp-client/ddp-client.py 关于python DDP客户端的一些初步工作已经完成,但尚未完成,请访问: https//github.com/meteor/meteor/blob/master/examples/unfinished/python-ddp-client/ddp-client.py

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM