Sha256: dc83cb866d43908d4b3a9d0d84bbde94cfdd71dc9e4217e8398787168193198c

Contents?: true

Size: 545 Bytes

Versions: 3

Compression:

Stored size: 545 Bytes

Contents

module EventMachine
  module WebSocket
    module Handshake75
      def self.handshake(headers, path, secure)
        scheme = (secure ? "wss" : "ws")
        location = "#{scheme}://#{headers['host']}#{path}"

        upgrade =  "HTTP/1.1 101 Web Socket Protocol Handshake\r\n"
        upgrade << "Upgrade: WebSocket\r\n"
        upgrade << "Connection: Upgrade\r\n"
        upgrade << "WebSocket-Origin: #{headers['origin']}\r\n"
        upgrade << "WebSocket-Location: #{location}\r\n\r\n"

        return upgrade
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
em-websocket-0.5.1 lib/em-websocket/handshake75.rb
em-websocket-0.5.0 lib/em-websocket/handshake75.rb
em-websocket-0.4.0 lib/em-websocket/handshake75.rb