Permalink
Browse files

Ensure ruby uses top-level WebSocket constant in client.rb

This commit enables compatibility with the em-websocket server gem.

The em-websocket gem adds a WebSocket module under the EventMachine
namespace. The client.rb file references the WebSocket constant while
executing within the EventMachine namespace. Once em-websocket is
required, client.rb begins using the WebSocket module provided by
the em-websocket gem instead of the correct top-level constant that
it expects, resulting in undefined method exceptions.
  • Loading branch information...
1 parent 47262a5 commit 60ebcbace700a840d22aa66e4395bd7dcc8d4dec @DanKnox committed Dec 25, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/websocket/eventmachine/client.rb
@@ -53,7 +53,7 @@ def initialize(args)
# @private
def post_init
@state = :connecting
- @handshake = WebSocket::Handshake::Client.new(@args)
+ @handshake = ::WebSocket::Handshake::Client.new(@args)
end
# Called by EventMachine after connecting.
@@ -67,11 +67,11 @@ def connection_completed
private
def incoming_frame
- WebSocket::Frame::Incoming::Client
+ ::WebSocket::Frame::Incoming::Client
end
def outgoing_frame
- WebSocket::Frame::Outgoing::Client
+ ::WebSocket::Frame::Outgoing::Client
end
public

0 comments on commit 60ebcba

Please sign in to comment.