2017-07-29 74 views

回答

1

我用Symfony Silex,RatchetPHP和OAuth2完成了它。

我首先从Silex RestApi获取OAuth访问令牌。

然后,当我打开连接时,我将它传递给棘轮websocket服务器,即websocket.connect('ws://localhost:8482?access_token=L83pR5amKt')

我可以用Ratchet检索它,最后我知道哪个用户在websocket连接后被认证。

+0

另外,我在砂岩中使用了这个技巧。您可能会对此感兴趣,因此以下是身份验证文档:https://eole-io.github.io/sandstone/authentication.html – Alcalyn