Method: #accept_connection
- Defined in:
- lib/easel/websocket.rb
#accept_connection(socket, ws_key) ⇒ Object
accept_connection
Sends back the HTTP header to initialize the websocket connection.
113 114 115 116 117 118 119 120 121 122 |
# File 'lib/easel/websocket.rb', line 113 def accept_connection(socket, ws_key) ws_accept_key = Digest::SHA1.base64digest( ws_key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11") socket.write "HTTP/1.1 101 Switching Protocols\r\n" + "Upgrade: websocket\r\n" + "Connection: Upgrade\r\n" + "Sec-WebSocket-Accept: #{ws_accept_key}\r\n" + "\r\n" end |