Redis error on websocket-rails when sending an event to a specific client

198 Views Asked by At

I am using 'threadsocket-rails'branch of websocket-rails gem and RedisCloud service of heroku with memory size 30MB.(link: https://elements.heroku.com/addons/rediscloud)

In my config, I have enable channel synchronization and set redis_options as:

config.redis_options = { :host => APP_CONFIG['REDIS_CLOUD_HOST'],
                            :port => APP_CONFIG['REDIS_CLOUD_PORT'],
                            :password => APP_CONFIG['REDIS_CLOUD_PASSWORD']}

When android or ios devices trigger the event, they get this empty hash (when I use redis):

["add_to_channel",{},{"id":null,"channel":null,"user_id":null,"success":false,"result":null,"token":null,"server_token":null}]

I also get this error:

 NameError Exception: undefined local variable or method `sync' for #<WebsocketRails::UserManager::LocalConnection:0x007fe271873c18>

Otherwise they get correct response("message":"user join new channel"):

["add_to_channel",{"message":"user join new channel"},{"id":null,"channel":null,"user_id":null,"success":false,"result":null,"token":null,"server_token":null}]

I use this code to send an event to a specific client:

WebsocketRails.users[recipient_id].send_message('add_to_channel', {:message => message[:body]})
0

There are 0 best solutions below