S
S
Semyon Semyonov2015-02-24 13:49:54
Ruby on Rails
Semyon Semyonov, 2015-02-24 13:49:54

How do you organize the mechanism for subscribing users to events?

Suppose we have a library of books. Books are added by a kind of scanner for all public books on the Internet. There are, of course, users in this library system. Users would like to subscribe to different events, for example:
- the appearance of new books
- the appearance of comments on the book
- the addition of Vasya and Petya of their books
And notifications .. Well, for example, Seryozha wants by mail, and Lyosha - sms. OK.
To manage subscriptions, we will apparently make a table of subscribers, where the subscriber user, subscription identifier, subscription class (book, user) will be indicated.
Question: How will this all work? :) The option to hang callbacks after each book save or save comment is the dumbest yet, but also the easiest.
I watched the wisperAnd to be honest, I didn't quite get it. For example, how it stores subscriber data. In the example, I indicated that there is a table, but how to teach wisper is not clear.
Are there any gems or some examples where to see how the subscription mechanism works? And then I got a little confused and it seems obvious from the text. :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Semyon Semyonov, 2015-02-24
@man_without_face

Seems to understand. Wisper is what you need. It's just that in the Listener you just need to look at the table of subscribers and send out the necessary notifications.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question