jam-cloud/websocket-gateway/lib/jam_websockets/client_context.rb

29 lines
570 B
Ruby
Raw Normal View History

2012-10-07 03:38:38 +00:00
module JamWebsockets
class ClientContext
attr_accessor :user, :client, :msg_count, :session, :sent_bad_state_previously
def initialize(user, client)
@user = user
2012-10-02 05:03:08 +00:00
@client = client
@msg_count = 0
@session = nil
@sent_bad_state_previously = false
end
2012-10-02 05:03:08 +00:00
def to_s
return "Client[user:#{@user} client:#{@client} msgs:#{@msg_count} session:#{@session}]"
end
def hash
@client.hash
end
def ==(o)
o.class == self.class && o.client == @client
end
alias_method :eql?, :==
end
end