1
しかし結果として、DB保存処理を走らせていないにも関わらず、3秒程度の間隔でクライアント側にメッセージが表示されました。
3秒おきに発生する理由は、ブラウザのEventSourceのreconnection timeの初期値が3秒で、3秒ごとに再接続しているからだと思います。再接続間隔はサーバーから送信するメッセージのretryフィールドで設定可能です。
https://html.spec.whatwg.org/multipage/comms.html#the-eventsource-interface
A reconnection time, in milliseconds. This must initially be a user-agent-defined value, probably in ...
1
下記の手順でプロジェクトをインポートしましたが、私の環境ではEclipseのエディタ上でエラーは発生せず、scala.concurrent.duration.Durationの定義元へ移動することもできました。
ご参考ください。
既に同様の手順で環境構築をされていて、エラーが発生している場合はご容赦ください。
(Eclipseは既に1年以上使用しておらず、個人的にはIntelliJを推奨します…)
環境:
Windows 10(64bit)
sbt 0.13.13
JDK 1.8.0_102
Scala 2.11.8
Scala IDEのために必要...?
手順:
Eclipse Neon.1a Release (4.6.1)をインストール
Scala IDE (Eclipse plugin)...
1
ControllerにBroadcast用のデータのレシーバーを用意して、データを受信したらBroadcastするようにして解決しました。
//Application.scala
object Application extends Controller {
var channel: MutableList[Concurrent.Channel[String]] = MutableList()
def socket = WebSocket.using[String] { request =>
val in = Iteratee.ignore[String]
val out = Concurrent.unicast[String]{ c => channel += c }
...
1
https://www.playframework.com/documentation/2.3.x/ScalaWebSockets#Handling-WebSockets-with-iteratees
上のドキュメントにあるように下記のような方法でどうでしょうか?
import play.api.mvc._
import play.api.libs.iteratee._
import play.api.libs.concurrent.Execution.Implicits.defaultContext
def socket = WebSocket.using[String] { request =>
// Concurrent.broadcast returns (Enumerator, ...
1
親 / 子
という階層が、routerを生成した場合には
親 / router / 子
となるので、この場合には子からparentを見たらrouterになります。context.parentの動作としては、おかしくなってはいません。(子という名前のまま統一しましたが、routerを使った方では階層上は、親から見たら孫になりました)
公式の説明で該当するのは、 http://doc.akka.io/docs/akka/2.3.10/scala/routing.html#supervision の以下の部分です。
Routees that are created by a pool router will be created as the router's children.
...
1
自分もあまり詳しくないですが、公式ドキュメントに以下のような例や記述があるので
val escalator = OneForOneStrategy() {
case e ⇒ testActor ! e; SupervisorStrategy.Escalate
}
val router = system.actorOf(RoundRobinPool(1, supervisorStrategy = escalator).props(
routeeProps = Props[TestActor]))
http://doc.akka.io/docs/akka/2.3.10/scala/routing.html#supervision
https://github.com/akka/akka/blob/v2....
上位に投票された、最小文字数のコミュニティ wiki 以外の回答のみが対象となります