调试websocket.md

This commit is contained in:
luzhisheng 2022-08-22 11:39:51 +08:00
parent 6103a77880
commit d460180374
4 changed files with 30 additions and 0 deletions

0
facebook私信/main.py Normal file
View File

19
facebook私信/readme1.md Normal file
View File

@ -0,0 +1,19 @@
fb测试地址
https://www.facebook.com/profile.php?id=100055837744229
![debugger](../img/107.png)
打开f12刷新页面发现fb存在 `pending` 连接。
以下是 WebSocket 对象的相关事件。
open Socket.onopen 连接建立时触发
message Socket.onmessage 客户端接收服务端数据时触发
error Socket.onerror 通信发生错误时触发
close Socket.onclose 连接关闭时触发
Socket.send() 使用连接发送数据
Socket.close() 关闭连接
先对 `Socket.send()` 打断点,但是发现存在很多位置,那如果快速找到 `Socket.send()` 发送的位置,`hook` `send()` 方法,直接快速

11
facebook私信/私信.py Normal file
View File

@ -0,0 +1,11 @@
import asyncio
import websockets
async def echo(websocket, path):
async for message in websocket:
message = "我收到了你的消息: {}".format(message)
await websocket.send(message)
asyncio.get_event_loop().run_until_complete(websockets.serve(echo, 'localhost', 8765))
asyncio.get_event_loop().run_forever()

BIN
img/107.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB