0

Use case : User logs in and can send xmpp messages to each other(controller1) , start a session

Now this session is a set of questions.(controller2) I want the xmpp connection to be prevailed across the 2 controllers

I am kind of lost in the design for this scenario

Any help appreciated!

4

1 回答 1

1

One of the ideas with play is zero-shared-state, this means that you normally do not have state across calls. The way to solve this kind of problem would be to fire up an akka actor that will own the xmpp connection when no request is being served and then figure out a suitable way to know what controller calls/what client should talk to that actor.

I can't find anything that relates to your exact problem but this page in the docs may help you a little: http://www.playframework.com/documentation/2.2.x/ScalaAkka also, check out the websocket chat sample projects that you can find with your play distribution, it uses one actor with multiple clients connected to it.

于 2013-09-16T17:05:03.170 回答