Play framework (Websocket): get browser info from request header-Collection of common programming errors
Actually play framework gives us everything (even a lot of know headers name). This is the code within a controller class’ static function
public class Application extends Controller {
public static Result index() {
String userAgent = request().headers().get(Http.HeadersNames.USER_AGENT);
return ok(userAgent);
}
}
Naturally I assume you are pointing to routes.Application.index() somewhere in your routes file.
If you are also wondering how to parse the user agent,I also advise you to check out :
https://code.google.com/p/user-agent-utils/
I used it in a project 6 months ago, I do not know how updated it is but it has worked great for me when I needed it for more usefull and readable informations.
Some browser do not fully implement what WebSockets protocol should have
After all it is a protocol still under definition/development.
For chrome it is a bug with a ticket https://code.google.com/p/chromium/issues/detail?id=128170
Apparently it has been fixed recently and should be rolled out soon? I assume it is the same with Safari.