ubuntu websocket python2
ubuntu下Python2.76
windows Python 2.79, chrome37 firefox35通過
代碼是在別人(cddn有人提問)基礎上改的, 主要改動了parsedata和sendmessage這2個函數.
改代碼參考下面了這段文檔. 主要是第5條, 發送的數據長度分別是 8bit和 16bit和 64 bit(即?127, 65535,和2^64-1)三種情況
發送和收取是一樣的, 例如
1.長度小于125時(由于使用126, 127用作標志位.)
2. 數據長度在128-65525之間時,?Payload Length位設為126, 后面額外使用16bit表示長度(前面的126不再是長度的一部分)
3.數據長度在65526-2^64-1之間時,?Payload Length位設為127, 后面額外使用64bit表示長度(前面的127不再是長度的一部分)
Fin (bit 0): determines if this is the last frame in the message. This would be set to 1 on the end of a series of frames, or in a single-frame message, it would be set to 1 as it is both the first and last frame.
RSV1, RSV2, RSV3 (bits 1-3): these three bits are reserved for websocket extensions, and should be 0 unless a specific extension requires the use of any of these bytes.
Opcode (bits 4-7): these four bits deterimine the type of the frame. Control frames communicate WebSocket st
Python Ubuntu websocket
版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。
版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。