Skip to content

Enhanced Support for browser Actor proxies#1698

Merged
dpp merged 3 commits into
masterfrom
dpp_extra_comet_args
Apr 17, 2015
Merged

Enhanced Support for browser Actor proxies#1698
dpp merged 3 commits into
masterfrom
dpp_extra_comet_args

Conversation

@dpp
Copy link
Copy Markdown
Member

@dpp dpp commented Apr 17, 2015

Added support to serverActorForClient to register for life cycle events as well as filtering the data before
it's sent to the client.

Opened and documented serverActorForClient so folks can add custom CometActors that
are programmatically generated rather than named.

@fmpwizard fmpwizard added this to the 3.0-M6 milestone Apr 17, 2015
dpp added a commit that referenced this pull request Apr 17, 2015
Enhanced Support for browser Actor proxies
@dpp dpp merged commit 4a3e6b4 into master Apr 17, 2015
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is like way late for me to be asking this, @dpp, but what was the reasoning behind exposing this instead of just using S.findOrCreateComet[T], which also handles ensuring that names are unique in the session? Wanted to drop a note about it in the release notes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed a place to dynamically create CometActors rather than refer to a CometActor that had been compiled with the project. Now how can one dynamically subclass a JVM class without compiling it with the project? Yep... it was some of the Scala/Clojure/Lift/Reagent inter-op stuff I've been doing.

But more broadly, I realized that there might be times even in pure Scala-land that one might want to do a:

new CometActor { ..... }

Rather than creating a separate CometActor subclass in a file with a name.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha! So the key here is the access to newCometFn that can produce an arbitrary T <: LiftCometActor, right? Can you drop a sample use here so I can use it in docs/release notes, by any chance? If not I'll just do some digging around myself :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay... here's an example https://github.com/dpp/devoxx_pl_2015_scala_clojure/blob/alt_comet/src/main/scala/sb/snippet/Actorize.scala#L29

I wound up extending serverActorForClient to include the lifecycle call-backs... but I liked the idea of being able to create an arbitrary CometActor class and maybe close over local scope rather than do the wonky "send a message and put the variables from the message in vars" paradigm. So I left buildAndStoreComet public.

@fmpwizard fmpwizard deleted the dpp_extra_comet_args branch November 30, 2015 03:20
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

Successfully merging this pull request may close these issues.

3 participants