V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
jianzhichao
V2EX  ›  Python

我想通过 tornado websocket 实现一个 一对一的聊天室

  •  
  •   jianzhichao · 2014-12-17 13:50:41 +08:00 · 5079 次点击
    这是一个创建于 3417 天前的主题,其中的信息可能已经有所发展或是发生改变。
    但是我对websocket的工作状态很是费解,在 网上找了一堆这方面的资料 看的 还是模模糊糊的,只知道首先是握手建立连接,但是前端为什么要用js 来握手呢?(不了解大部分资料都是用js)。谁能给我一个清晰 简单的例子啊,比如我更改什么地方 能够建立连接,更改什么地方能够向服务器发送消息,前端发送之后 后端如何接收,,然后后端如何向前端发送数据,之类的。谢谢大神啊。实在没办法了 才来救助的。
    2 条回复    2014-12-19 20:30:48 +08:00
    zenliver
        1
    zenliver  
       2014-12-17 17:46:46 +08:00
    先看一下websocket协议,,,然后,,,不想用js, browser如果还支持其他脚本语言, 应该也是可以用的, 似乎没见过, 然后,,,tornado自己有个demo, 可以参考(对于大多数人来说, 协议细节不需要知道, 知道怎么用就行了)
    laike9m
        2
    laike9m  
       2014-12-19 20:30:48 +08:00
    前端 socket.io,后端就用 tornado 的 websocket,这样是可以的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4937 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 03:57 · PVG 11:57 · LAX 20:57 · JFK 23:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.