fer*_*k86 4 scala websocket akka playframework playframework-2.3
我有一个使用play 2.3 web socket actor功能创建的websocket.如何访问创建的actor以在其他函数中发送消息?
def websocket: WebSocket[JsValue, JsValue] =
WebSocket.acceptWithActor[JsValue, JsValue] {
req => out => Props(new MyActor(out))
}
Run Code Online (Sandbox Code Playgroud)
给你的演员一个经理的参考:
def websocket: WebSocket[JsValue, JsValue] =
WebSocket.acceptWithActor[JsValue, JsValue] {
req => out => Props(new MyActor(managerRef, out))
}
Run Code Online (Sandbox Code Playgroud)
让你的演员注册你的经理preStart.
| 归档时间: |
|
| 查看次数: |
781 次 |
| 最近记录: |