Created
November 18, 2011 08:58
-
-
Save ql/1375956 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jWebSocket handshake request: | |
| [[:receive_data, | |
| "GET / HTTP/1.1\r\nHost: 10.40.21.133\r\nUpgrade: WebSocket\r\nConnection: Upgrade\r\nSec-WebSocket-Origin: http://10.40.21.133\r\nSec-WebSocket-Protocol: org.jwebsocket.json\r\nSec-WebSocket-Key: 86OhCtcFEa8VRGBQ9R7u1Q==\r\nSec-WebSocket-Version: 8\r\n"]] | |
| Chrome handshake request: | |
| [[:receive_data, | |
| "GET / HTTP/1.1\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nHost: localhost:3000\r\nSec-WebSocket-Origin: null\r\nSec-WebSocket-Key: UOShYhJF+HYUBLtDYNtgnw==\r\nSec-WebSocket-Version: 8\r\n\r\n"]] | |
| em-websocket code: | |
| module EventMachine | |
| module WebSocket | |
| class HandlerFactory | |
| PATH = /^(\w+) (\/[^\s]*) HTTP\/1\.1$/ | |
| HEADER = /^([^:]+):\s*(.+)$/ | |
| def self.build(connection, data, secure = false, debug = false) | |
| (header, remains) = data.split("\r\n\r\n", 2) | |
| unless remains | |
| # The whole header has not been received yet. | |
| return nil | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment