Spring Framwork Web on Servlet Stack v5.3.36 SNAPSHOT1. Introduction to WebSocket. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 4.1.1. HTTP Versus WebSocket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 4.2. WebSocket API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 4.2.2. WebSocket Handshake . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0 码力 | 259 页 | 3.58 MB | 1 年前3
websockets Documentation
Release 9.073 Index 75 i ii websockets Documentation, Release 9.0 websockets is a library for building WebSocket servers and clients in Python with a focus on correctness and simplicity. Built on top of asyncio hello(): uri = "ws://localhost:8765" async with websockets.connect(uri) as websocket: await websocket.send("Hello world!") await websocket.recv() asyncio.get_event_loop().run_until_complete(hello()) And here’s /usr/bin/env python import asyncio import websockets async def echo(websocket, path): async for message in websocket: await websocket.send(message) start_server = websockets.serve(echo, "localhost", 8765)0 码力 | 81 页 | 352.88 KB | 1 年前3
websockets Documentation
Release 5.0Module Index 49 i ii websockets Documentation, Release 5.0 websockets is a library for building WebSocket servers and clients in Python with a focus on correctness and simplicity. Built on top of asyncio asyncio import websockets async def hello(uri): async with websockets.connect(uri) as websocket: await websocket.send("Hello world!") asyncio.get_event_loop().run_until_complete( hello('ws://localhost:8765')) /usr/bin/env python import asyncio import websockets async def echo(websocket, path): async for message in websocket: await websocket.send(message) asyncio.get_event_loop().run_until_complete( websockets0 码力 | 56 页 | 245.43 KB | 1 年前3
websockets Documentation
Release 6.0Module Index 51 i ii websockets Documentation, Release 6.0 websockets is a library for building WebSocket servers and clients in Python with a focus on correctness and simplicity. Built on top of asyncio asyncio import websockets async def hello(uri): async with websockets.connect(uri) as websocket: await websocket.send("Hello world!") asyncio.get_event_loop().run_until_complete( hello('ws://localhost:8765')) /usr/bin/env python import asyncio import websockets async def echo(websocket, path): async for message in websocket: await websocket.send(message) asyncio.get_event_loop().run_until_complete( websockets0 码力 | 58 页 | 253.08 KB | 1 年前3
websockets Documentation
Release 4.0Module Index 41 i ii websockets Documentation, Release 4.0 websockets is a library for building WebSocket servers and clients in Python with a focus on correctness and simplicity. Built on top of asyncio asyncio import websockets async def hello(uri): async with websockets.connect(uri) as websocket: await websocket.send("Hello world!") asyncio.get_event_loop().run_until_complete( hello('ws://localhost:8765')) /usr/bin/env python import asyncio import websockets async def echo(websocket, path): async for message in websocket: await websocket.send(message) asyncio.get_event_loop().run_until_complete( websockets0 码力 | 48 页 | 224.70 KB | 1 年前3
websockets Documentation
Release 3.4Index 29 i ii websockets Documentation, Release 3.4 websockets is a library for developing WebSocket servers and clients in Python. It implements RFC 6455 with a focus on correctness and simplicity Here’s a WebSocket server example. It reads a name from the client, sends a greeting, and closes the connection. #!/usr/bin/env python import asyncio import websockets async def hello(websocket, path): path): name = await websocket.recv() print("< {}".format(name)) greeting = "Hello {}!".format(name) await websocket.send(greeting) print("> {}".format(greeting)) start_server = websockets.serve(hello, 'localhost'0 码力 | 36 页 | 192.66 KB | 1 年前3
websockets Documentation
Release 3.3Index 25 i ii websockets Documentation, Release 3.3 websockets is a library for developing WebSocket servers and clients in Python. It implements RFC 6455 with a focus on correctness and simplicity Here’s a WebSocket server example. It reads a name from the client, sends a greeting, and closes the connection. #!/usr/bin/env python import asyncio import websockets async def hello(websocket, path): path): name = await websocket.recv() print("< {}".format(name)) greeting = "Hello {}!".format(name) await websocket.send(greeting) print("> {}".format(greeting)) start_server = websockets.serve(hello, 'localhost'0 码力 | 32 页 | 176.18 KB | 1 年前3
ThinkJS 1.2 中文文档ThinkJS 是⼀一款⾼高效、简单易⽤用的 Node.js MVC 框架。基于 ES6 Promise 开发,让异步编程更加简单、⽅方便。 ⾃自动启动服务 ⽀支持 Http、命令⾏行、WebSocket、Restful等多种⽅方式调⽤用 CBD 架构,MVC 模式 基于 Promise,异步编程更加简单 封装了 Db, Cache, Session 等常⽤用功能 开发模式下⽂文件修改后⽴立即⽣生效,⽆无需重启 // ⽤用户名 'db_pwd': '', // 密码 'use_websocket': true, // 使⽤用 websocket } JavaScript 注意: 配置参数的 key 不区分⼤大⼩小写(key 会强制转为⼩小写)。建议使⽤用⼩小写,便于阅读。 配置值除了是 return self.success(); }) ThinkJS 可以⽆无缝的⽀支持 websocket ,写 WebSocket 的逻辑和普通的 Http 请求的⽅方式⼀一致,底层使⽤用了 websocket-driver 模块。 websocket 的功能默认是关闭的,使⽤用 WebSocket 需要开启下⾯面的配置: 还有下⾯面的配置可以设置: 为了更好的规范浏览器端和服务端之间传送的数据格式,ThinkJS0 码力 | 104 页 | 1.29 MB | 1 年前3
websockets Documentation
Release 3.2Index 25 i ii websockets Documentation, Release 3.2 websockets is a library for developing WebSocket servers and clients in Python. It implements RFC 6455 with a focus on correctness and simplicity Here’s a WebSocket server example. It reads a name from the client, sends a greeting, and closes the connection. #!/usr/bin/env python import asyncio import websockets async def hello(websocket, path): path): name = await websocket.recv() print("< {}".format(name)) greeting = "Hello {}!".format(name) await websocket.send(greeting) print("> {}".format(greeting)) start_server = websockets.serve(hello, 'localhost'0 码力 | 32 页 | 170.46 KB | 1 年前3
websockets Documentation
Release 2.7Index 21 i ii websockets Documentation, Release 2.7 websockets is a library for developing WebSocket servers and clients in Python. It implements RFC 6455 with a focus on correctness and simplicity example Here’s a WebSocket server example. It reads a name from the client and sends a message. #!/usr/bin/env python import asyncio import websockets @asyncio.coroutine def hello(websocket, path): name name = yield from websocket.recv() print("< {}".format(name)) greeting = "Hello {}!".format(name) yield from websocket.send(greeting) print("> {}".format(greeting)) start_server = websockets.serve(hello0 码力 | 28 页 | 157.50 KB | 1 年前3
共 566 条
- 1
- 2
- 3
- 4
- 5
- 6
- 57













