1

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]})
Sachin Prasad
  • 5,365
  • 12
  • 54
  • 101
  • Hey Sachin, I was wondering if you managed to fix the problem. I recently got the `threadsocket-rails` branch "up and running" on my Puma production server but I seem to be running into the same problem. I had two "classes" of users for websockets, and they were denoted with their class name in front of their users id inside the User Manager. Messages were sent and received for one class of users but not the other. I've been resorting to Thin on my production server but I can't scale dynos since synchronize is turned off (it raises a FiberError otherwise). – Richard Jan 21 '16 at 05:50

0 Answers0