new chat lila-ws msgs
parent
2357320e3a
commit
34c19f910a
|
@ -31,7 +31,12 @@ object RoomSocket {
|
|||
case SetVersion(v) => version = v
|
||||
case nv: NotifyVersion[_] =>
|
||||
version = version.inc
|
||||
send(Protocol.Out.tellRoomVersion(roomId, nv.msg, version, nv.troll))
|
||||
send {
|
||||
val tell =
|
||||
if (chatMsgs(nv.tpe)) Protocol.Out.tellRoomChat _
|
||||
else Protocol.Out.tellRoomVersion _
|
||||
tell(roomId, nv.msg, version, nv.troll)
|
||||
}
|
||||
}
|
||||
override def stop() = {
|
||||
super.stop()
|
||||
|
@ -84,6 +89,8 @@ object RoomSocket {
|
|||
}
|
||||
}
|
||||
|
||||
private val chatMsgs = Set("message", "chat_timeout", "chat_reinstate")
|
||||
|
||||
def subscribeChat(rooms: TrouperMap[RoomState]) = {
|
||||
import lila.chat.actorApi._
|
||||
lila.common.Bus.subscribeFun("chat") {
|
||||
|
@ -146,6 +153,8 @@ object RoomSocket {
|
|||
s"tell/room/user $roomId $userId ${Json stringify payload}"
|
||||
def tellRoomUsers(roomId: RoomId, userIds: Iterable[User.ID], payload: JsObject) =
|
||||
s"tell/room/users $roomId ${P.Out.commas(userIds)} ${Json stringify payload}"
|
||||
def tellRoomChat(roomId: RoomId, payload: JsObject, version: SocketVersion, isTroll: Boolean) =
|
||||
s"tell/room/chat $roomId $version ${P.Out.boolean(isTroll)} ${Json stringify payload}"
|
||||
def stop(roomId: RoomId) =
|
||||
s"room/stop $roomId"
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ final class RoundSocket(
|
|||
initialCapacity = 65536
|
||||
)
|
||||
|
||||
def tellRound(gameId: Game.Id, msg: Any): Unit = rounds.tell(gameId.value, msg)
|
||||
private def tellRound(gameId: Game.Id, msg: Any): Unit = rounds.tell(gameId.value, msg)
|
||||
|
||||
private lazy val roundHandler: Handler = {
|
||||
case Protocol.In.PlayerMove(fullId, uci, blur, lag) if !stopping =>
|
||||
|
|
Loading…
Reference in New Issue