How to use TLS in Play!Framework WebSockets (“wss://”)

后端 未结 4 1622
走了就别回头了
走了就别回头了 2020-12-05 08:51

I cannot use wss:// in my simple WebSocket app created with Play!Framework 2.2. It echoes the message back. The endpoint is like this

def indexW         


        
4条回答
  •  执笔经年
    2020-12-05 09:07

    Did you try enabling https support on the Play server? It looks like you're trying to connect to the http port using wss, that can never work, you need to enable https, and then change the URL not just to wss, but also to use the https port.

    To start a Play server with ssl turned on:

    activator run -Dhttps.port=9443
    

    Then connect to wss://localhost:9443/ws2.

提交回复
热议问题