kneczaj / pi-puppids

Automatically exported from code.google.com/p/pi-puppids
0 stars 0 forks source link

Add a history funtionality which persists game-notifications #16

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Things like "Someone conquered my place" should be stored and displayed to the 
user there.

Original issue reported on code.google.com by peter.re...@gmail.com on 9 Jan 2013 at 5:02

GoogleCodeExporter commented 8 years ago

Original comment by peter.re...@gmail.com on 24 Jan 2013 at 1:15

GoogleCodeExporter commented 8 years ago

Original comment by Markus.F...@googlemail.com on 25 Jan 2013 at 8:58

GoogleCodeExporter commented 8 years ago
So backend works. Everything which extends Notification class is treated as 
notification and saved in Notifications collection. Pairs <Player, 
Notification> are saved additionally in UndeliveredNotifications collection. 
All undelivered notifications can be obtained, and at the same time deleted 
from this collection with
NotificationService/takeUndeliveredNotifications.

We need frontend which displays "notificationMessage" value from every Json 
object sent by WebSocket which has this value. That would solve the issue of 
real-time notifications. What to do when we want to see 10 last ones? Should I 
add such a function to controllers? What should be a format of history of 
notifications send to a browser? also Json? Is Json list of objects only with 
field "notificationMessage" and its value a right format?

Original comment by knec...@gmail.com on 30 Jan 2013 at 12:27

GoogleCodeExporter commented 8 years ago
I sometimes get such an exception:

play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception 
[[ClassCastException: models.notifications.Simpl
eNotificationMessage cannot be cast to models.notifications.Notification]]
        at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.0.4]
        at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.4]
        at akka.actor.Actor$class.apply(Actor.scala:318) [akka-actor.jar:2.0.2]
        at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1.jar:2.0.4]
        at akka.actor.ActorCell.invoke(ActorCell.scala:626) [akka-actor.jar:2.0.2]
        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197) [akka-actor.jar:2.0.2]
Caused by: java.lang.ClassCastException: 
models.notifications.SimpleNotificationMessage cannot be cast to models.notific
ations.Notification
        at controllers.NotificationController.getHistory(NotificationController.java:46) ~[classes/:2.0.4]
        at Routes$$anonfun$routes$1$$anonfun$apply$33$$anonfun$apply$34.apply(routes_routing.scala:312) ~[classes/:na]
        at Routes$$anonfun$routes$1$$anonfun$apply$33$$anonfun$apply$34.apply(routes_routing.scala:312) ~[classes/:na]
        at play.core.Router$HandlerInvoker$$anon$5$$anon$1.invocation(Router.scala:1090) ~[play_2.9.1.jar:2.0.4]
        at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:33) ~[play_2.9.1.jar:2.0.4]
        at play.GlobalSettings$1.call(GlobalSettings.java:57) ~[play_2.9.1.jar:2.0.4]

but quite surprising is the fact I get it only sometimes. Then I can restart 
play, reload page, and I will get the notification list without this exception. 
Can you look at this?

Another thing is that when I uncomment line 58 in NotificationsServiceImpl, I 
cannot compile the application. In this line there is saveNotification 
instruction, which is defined in the same file.

Original comment by knec...@gmail.com on 9 Feb 2013 at 3:30