Websocket in play framework 1.2.x

68 views
Skip to first unread message

Sultan Zhiyenbay

unread,
Sep 14, 2013, 6:07:14 AM9/14/13
to pla...@googlegroups.com
I am writing my project in play framework 1.2.x and I want to use websockets, I look at chat example, but there server outbound to all clients, can anybody help me how to outbound to one or several clients checking by username or something else.
Thanks

Israel Tsadok

unread,
Sep 15, 2013, 12:00:48 AM9/15/13
to pla...@googlegroups.com
Web sockets are initiated by the browser and are one-to-one communication. The chat example uses a ChatRoom object to send events to all the connected web sockets. Check out the manual for a simpler example of WebSockets: the echo server is echoing each browser separately, no broadcast involved.

If you want to customize the chat example, you should modify the ChatRoom class. For example, you could modify ChatRoom.get( ) to accept a roomName parameter and return or create the appropriate ChatRoom object.

Sultan Zhiyenbay

unread,
Sep 17, 2013, 12:40:04 AM9/17/13
to pla...@googlegroups.com
Thanks,it works

суббота, 14 сентября 2013 г., 16:07:14 UTC+6 пользователь Sultan Zhiyenbay написал:
Reply all
Reply to author
Forward
0 new messages