General question about using Lift on a specific project

40 views
Skip to first unread message

David Ison

unread,
Mar 28, 2016, 12:44:41 PM3/28/16
to Lift
Hello all

A general question about using Lift in a use case where there are network events to deal with, eg realtime video, in addition to UI from browser.

Scenario:

A couple hundred users are logged in.

One user, we will call BigVoice, starts a video (eg WebRTC) stream with camera and mic on. 

Some other logged in users, SubscriberA .. SubscriberD, are subscribed to BigVoice's channel, similar to how youtube works.

The requirements are - to  send a message to all the subscriber's, in order to notify them - 

"Hey a channel you are interested in just started streaming .,."

From studying the framework - it appears we might be able to send a message to the Comet Actors currently interfacing with the Subscriber's browsers.

I am new but really like Scala.  Feel like a hitchhiker from the C++ world.

Any insights appreciated.






Diego Medina

unread,
Mar 28, 2016, 1:06:12 PM3/28/16
to Lift
Hi David,

You are right that you could use a CometActor for the notification, a while I made this 3 part video about Lift Comet actors, while it was written for Lift 2.5, the concepts still apply for 2.6 and 3.0 http://blog.fmpwizard.com/blog/comet-actors-presentation

There I walk through a similar scenario, where you are on a site like ebay, so what on your case is a video streaming channel, in the example video is an item N people want to buy. When one person makes a bid, all other "subscribers" get the updated price, in your case, they would get some kind of javascript that will trigger a notice so they know to go check the channel, This assumes your users are on your site, but on other pages, you can then hook into sending them an email if that is also what you need.

Thanks and let us know if you have any more questions.

Diego


--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Diego Medina
Lift/Scala Consultant
di...@fmpwizard.com
http://blog.fmpwizard.com/

David Ison

unread,
Mar 29, 2016, 5:51:12 PM3/29/16
to Lift

Yes it was a good walk thru - I watched the three videos.  

 This concept of a named Actor - would that be done, for example, when a user logs in - to use the session or other info to get a unique identifier for the actor connected to that browser?  The actor sets up its own name.

Then the dispatcher could use some kind of group identifier to associate a bunch of actors together.

This could be reasonably scalable using a document database to do these different groups? 

For example - one of the people watching the video stream wants to join in, or send a comment to the BigVoice user who is publishing video.

With all these different events there are many different groupings for the dispatcher to resolve.

Diego Medina

unread,
Mar 29, 2016, 8:55:13 PM3/29/16
to Lift
Answers inline:

On Tue, Mar 29, 2016 at 5:51 PM, David Ison <dtison...@gmail.com> wrote:

Yes it was a good walk thru - I watched the three videos.  

 This concept of a named Actor - would that be done, for example, when a user logs in - to use the session or other info to get a unique identifier for the actor connected to that browser?  The actor sets up its own name.


yes, you can pick whatever fits your needs, you can use the sessionId, or you can use the user's username, if you pick the user's username, then he/she would get a notification even if they have several browsers on different computers.
 

Then the dispatcher could use some kind of group identifier to associate a bunch of actors together.

This could be reasonably scalable using a document database to do these different groups? 


Yes, what you could do is to store in a database all users that are subscribed to BigVoice, when BigVoice starts streaming, you then lookup all actors that belong to those users (so using the username may be a good idea here), and once you have the list of actors, then you send them a msg about the new streaming that is taking place.


 

For example - one of the people watching the video stream wants to join in, or send a comment to the BigVoice user who is publishing video.

With all these different events there are many different groupings for the dispatcher to resolve.

You do your gropings wither in memory or in your database, and then just do the lookups in the dispatcher to see which actors should get the message.

Hope that was clear.

If the idea still feels a bit fuzzy, I think it would help you if you start a new project, simple where you add very basic code to simulate the BigVoice idea, and apply the named comet actors idea, that way, if you get stuck, you can publish that project on github and we can take a look and help you get it going. For an example of how we prefer sample projects, see https://www.assembla.com/wiki/show/liftweb/Posting_example_code

Thanks and looking forward to seeing what you come up with.

Diego

 

--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Ison

unread,
Mar 31, 2016, 12:08:56 AM3/31/16
to Lift
Gracias Diego - this thread has been helpful.

The next step is - I have to get more competent using SBT and Lift and  the JVM world.  
I got into Scala because of interest in Functional Programming - and Scala  seems to get this right - and be more feasible at the moment than going all the way into Learn You a Haskell for Great Good :) 

I encountered build errors trying to run the chat demo on https://github.com/dpp/simply_lift.

Should I start another topic for that?

Any other hints or consejos for getting all the framework running, will help.  For example - I am used to either Apache or NginX taking the requests, and some kind of LAMP or Rails backend handling MVC, but Lift looks almost completely different. I have also used Express and NodeJS.  Is it more like that?

Diego Medina

unread,
Mar 31, 2016, 9:49:09 AM3/31/16
to Lift
Gracias Diego - this thread has been helpful.


Great!
 

The next step is - I have to get more competent using SBT and Lift and  the JVM world.  
I got into Scala because of interest in Functional Programming - and Scala  seems to get this right - and be more feasible at the moment than going all the way into Learn You a Haskell for Great Good :) 


For the most part, you can get by with minimum sbt and JVM knowledge, sbt lets you do all kinds of things, but you can keep it simple and try new features as you go along, same with the jvm, once you get the basic ideas of what a jar/war is and a few other things, that's enough, and later on you can look into which flags to pass the jvm to adjust things like garbage collector, etc


I encountered build errors trying to run the chat demo on https://github.com/dpp/simply_lift.

Should I start another topic for that?

Yes please
 

Any other hints or consejos for getting all the framework running, will help.  For example - I am used to either Apache or NginX taking the requests, and some kind of LAMP or Rails backend handling MVC, but Lift looks almost completely different. I have also used Express and NodeJS.  Is it more like that?


I haven't used Express nor NodeJS before, but changes are that nothing you have ever tried before is similar to how Lift works :)

Lift will be the one taking requests, you tell how to handle this using SiteMap. If you haven't see it yet, there is this book that is available online http://cookbook.liftweb.net/

and on the lower right corner of http://liftweb.net/ you see a list of other books that are about Lift.

Form there, the most up to date books are

Simply Lift

Lift Cookbook A community question and answers book, free at cookbook.liftweb.net

Lift Web Applications How-to by Torsten Uhlmann is available in print and eBook format.

Lift Application Development Cookbook by Gilberto T. Garcia Jr. 

In general, we don't have the best documentation out there, but we make up for it with the mailing list, search it when you are blocked on anything and if you don't find an answer, post a question and we'll help you.

Thanks

Diego

--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages