把高速公路带到你的同步应用程序!
autobahn-sync的Python项目详细描述
高速公路~同步
Autobahn与crochet集成,为同步应用程序提供wamp。
最初基于Sam & Max(警告:法语,pr0n和里面的敬畏!).
快速示例
fromtimeimportsleepfromautobahn_syncimportpublish,call,register,subscribe,run@register('com.app.shout')defshout(msg):returnmsg.upper()@subscribe('com.app.idea')defon_thought(msg):print("I've just had a new idea: %s"%msg)run()whileTrue:print(call('com.app.shout','Autobahn is cool !'))publish('com.app.idea','Use autobahn everywhere !')sleep(1)
此代码将连接到crossbar路由器(不要忘记启动它 在尝试此片段之前!)正在收听ws://127.0.0.1:8080/ws 并在领域realm1中注册自己。
有关更多用例,请参见examples。
奖金
请参阅extensions文件夹以获得一个不错的烧瓶扩展;-)
立即获取
pip install -U autobahn-sync
许可证
麻省理工学院许可。有关详细信息,请参见捆绑的LICENSE文件。