Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.1k views
in Technique[技术] by (71.8m points)

python websocket get 方法如何发送请求,?

今天抓包抓到了一个websocket get 请求 这个协议如何发送你?websocket 有get 这种方法请求?

GET /webcast/im/push/?aid=1128&device_id=68340616007&access_key=e5a5d78a5d3d4b471e280ab4b96edb68&fpid=9&sdk_version=3&iid=1319060892290383&sid=dcecb2f22da348382779899d24c84534&pl=1&ne=1&version_code=130900&is_background=-1&ac=WIFI&aid=1128&appTheme=dark&app_language=zh&app_name=aweme&app_version=13.9.0&build_number=139016&cdid=70E802B3-46D4-4F8E-BD94-4ECE805C5168&channel=App%20Store&compress=gzip&current_network_quality_info={%22video_download_speed%22:2273,%22downstream_throughput_kbps%22:2438,%22quic_rtt%22:26,%22quic_receive_loss_rate%22:-1,%22http_rtt%22:64,%22net_effective_connection_type%22:7,%22quic_send_loss_rate%22:-1,%22tcp_rtt%22:26}&cursor=1608532184346_6908593120548498835_1_1&device_id=68340616007&device_platform=iphone&device_type=iPhone%20X&effect_sdk_version=8.1.0&identity=audience&idfa=8A1736A8-BC2A-4914-8064-C36670461750&iid=1319060892290383&imprp=d4DYfCuO3sBu8&internal_ext=fetch_time:1608532184346|start_time:0|flag:0|seq:1|next_cursor:1608532184346_6908593120548498835_1_1|door:6-n3&is_vcd=1&js_sdk_version=1.91.0.3&language=en-TW&last_rtt=288&live_id=1&live_ws_local_identify=live_ws_identify_local&mcc_mnc=46002&openudid=db5050c2560532cf159e246cfae47c838f8aae4c&os_api=18&os_version=13.7&parse_cnt=4&pass-region=0&pass-route=0&recv_cnt=4&resp_content_type=protobuf&room_id=6908582795129654024&screen_width=375&sid=dcecb2f22da348382779899d24c84534&tma_jssdk_version=1.91.0.3&version_code=13.9.0&vid=2FBA1918-DBCF-4AFB-86FB-18A0F229145F&webcast_gps_access=1&webcast_language=zh&webcast_locale=zh-Hans_CN&webcast_sdk_version=1800 HTTP/1.1
Host: webcast3-ws-c-lq.amemv.com
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Origin: wss://webcast3-ws-c-lq.amemv.com
Sec-WebSocket-Version: 13
x-tt-trace-id: 00-83fd4f3809fe96b0b470603ff8770468-83fd4f3809fe96b0-01
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Cronet Mobile/15E148 Safari/605.1
Accept-Encoding: gzip, deflate, br
Cookie: d_ticket=8c7959af9256f904126faa3cdc8b2df222907; odin_tt=d7d47761b0398c1c643cec118a7340a0622beeac768bf6b5fc6f5f3023bdca59100973a35d09a010c559b256c6f37994a33baae44ef43989cdfebead46643031; passport_csrf_token=cec8371850d90e9f2f0a2c278839b221; sessionid=dcecb2f22da348382779899d24c84534; sessionid_ss=dcecb2f22da348382779899d24c84534; sid_guard=dcecb2f22da348382779899d24c84534%7C1608302850%7C5183357%7CTue%2C+16-Feb-2021+14%3A36%3A47+GMT; sid_tt=dcecb2f22da348382779899d24c84534; uid_tt=ce9ed4a82ccd4dcd4f15891e68f2e324; uid_tt_ss=ce9ed4a82ccd4dcd4f15891e68f2e324; install_id=1319060892290383; ttreq=1$93ff636753f19e58fe19edac0f96b9aee7b8494c
Sec-WebSocket-Key: 8VDDwnX+i9x1sSP3U0NBug==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Sec-WebSocket-Protocol: pbbp2

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

GET 这个是做协议升级, websocket的握手阶段

上面的头信息之中,有一个 HTTP 头是Upgrade。HTTP1.1 协议规定,Upgrade字段表示将通信协议从HTTP/1.1转向该字段指定的协议

Connection字段表示浏览器通知服务器,如果可以的话,就升级到 WebSocket 协议

https://developer.mozilla.org...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...