【问题标题】:How to get the reversed route of a WebSocket in Play2.0Play2.0中如何获取WebSocket的反向路由
【发布时间】:2012-02-25 08:25:08
【问题描述】:

如果我给出这个,在 html 模板中:

@routes.Application.chat(username).webSocketURL()

我明白了:

ws://localhost:9000/room/chat?username=test

我想要一种在 Scala 类中将其作为字符串获取的方法。

【问题讨论】:

    标签: scala routes playframework playframework-2.0


    【解决方案1】:

    您可以在documentation 中找到,使用:

    controllers.routes.chat(username).webSocketURL()
    

    【讨论】:

    • 不,它不适用于 websocket,我添加了一个几乎空的模板。
    • @shenshei 你能用你正在使用的代码更新问题吗?
    猜你喜欢
    • 2013-08-05
    • 1970-01-01
    • 2014-07-15
    • 1970-01-01
    • 2018-06-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多