Skip to content

Commit

Permalink
Following default port change in specification.
Browse files Browse the repository at this point in the history
Adding copyright/licence header to each file.
  • Loading branch information
gimite committed Sep 5, 2009
1 parent bf50ec7 commit 2afb526
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/web_socket.rb
@@ -1,4 +1,6 @@
# Ref: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-31
# Copyright: Hiroshi Ichikawa <http://gimite.net/en/>
# Lincense: New BSD Lincense
# Reference: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-31

require "socket"
require "uri"
Expand Down Expand Up @@ -60,7 +62,7 @@ def initialize(arg, params = {})
end
@path = (uri.path.empty? ? "/" : uri.path) + (uri.query ? "?" + uri.query : "")
origin = params[:origin] || "http://#{uri.host}"
@socket = TCPSocket.new(uri.host, uri.port || 81)
@socket = TCPSocket.new(uri.host, uri.port || 80)
@socket.write(
"GET #{@path} HTTP/1.1\r\n" +
"Upgrade: WebSocket\r\n" +
Expand Down Expand Up @@ -169,7 +171,7 @@ class WebSocketServer

def initialize(uri, params = {})
@uri = uri.is_a?(String) ? URI.parse(uri) : uri
port = params[:port] || @uri.port || 81
port = params[:port] || @uri.port || 80
if params[:host]
@tcp_server = TCPServer.open(params[:host], port)
else
Expand Down
3 changes: 3 additions & 0 deletions samples/chat_server.rb
@@ -1,3 +1,6 @@
# Copyright: Hiroshi Ichikawa <http://gimite.net/en/>
# Lincense: New BSD Lincense

require "web_socket"
require "thread"

Expand Down

0 comments on commit 2afb526

Please sign in to comment.