Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot subscribe to model outside of route #212

Closed
rasteiner opened this issue Feb 19, 2015 · 2 comments
Closed

Cannot subscribe to model outside of route #212

rasteiner opened this issue Feb 19, 2015 · 2 comments

Comments

@rasteiner
Copy link

Using DerbyJS.

Inside of server.js,after creating the store and attaching all the express middleware, this snippet doesn't work for me:

var model = store.createModel();
model.subscribe('foo', function() {
});

This crashes the server with a redis exception:

Error: Connection in subscriber mode, only subscriber commands may be used
  at RedisClient.send_command (/fakepath/node_modules/redis-url/node_modules/redis/index.js:834:15)
  at RedisClient.send_offline_queue (/fakepath/node_modules/redis-url/node_modules/redis/index.js:443:34)
  at RedisClient.on_ready (/fakepath/node_modules/redis-url/node_modules/redis/index.js:371:14)
  at RedisClient.on_info_cmd (/fakepath/node_modules/redis-url/node_modules/redis/index.js:406:14)
  at /fakepath/node_modules/redis-url/node_modules/redis/index.js:430:14
  at try_callback (/fakepath/node_modules/redis-url/node_modules/redis/index.js:592:9)
  at RedisClient.return_reply (/fakepath/node_modules/redis-url/node_modules/redis/index.js:685:13)
  at ReplyParser.<anonymous> (/fakepath/node_modules/redis-url/node_modules/redis/index.js:321:14)
  at ReplyParser.emit (events.js:107:17)
  at ReplyParser.send_reply (/fakepath/node_modules/redis-url/node_modules/redis/lib/parser/javascript.js:300:10)
  at ReplyParser.execute (/fakepath/node_modules/redis-url/node_modules/redis/lib/parser/javascript.js:203:22)
  at RedisClient.on_data (/fakepath/node_modules/redis-url/node_modules/redis/index.js:547:27)
  at Socket.<anonymous> (/fakepath/node_modules/redis-url/node_modules/redis/index.js:102:14)
  at Socket.emit (events.js:107:17)
  at readableAddChunk (_stream_readable.js:163:16)
  at Socket.Readable.push (_stream_readable.js:126:10)
  at TCP.onread (net.js:529:20)

Is this normal? The documentation says:

If you would like to get or set data outside of the app on the server, you can create models directly via store.createModel().

@enjalot
Copy link
Contributor

enjalot commented Feb 19, 2015

this is more of a debugging question rather than an issue with the library. As such could you please use Stack Overflow and tag it with racer and derbyjs?
When you do so could you please include a minimal example to reproduce. You are correct that this should work so its likely something else is going on.

I'm just recently starting to encourage people to use SO, and we haven't officially announced it. you can also ping us in the gitter chatroom or on the mailing list with the SO link: http://derbyjs.com/resources

@enjalot enjalot closed this as completed Feb 19, 2015
@minicuper
Copy link
Contributor

Offtopic: Think it's a very good idea to use SO for all kind of derby (and so on) questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants