How can I realize digest authentication and subscription with sockets in a Server to Server application with PHP. What options do I have?
Advertisement
Answer
I’ve done it with Symfony Silex, RatchetPHP and OAuth2.
I first get an OAuth access token from the Silex RestApi.
Then I pass it to the Ratchet websocket server as a url parameter when I open the connection, i.e websocket.connect('ws://localhost:8482?access_token=L83pR5amKt')
.
I can retrieve it with Ratchet, and finally I know which user is authenticated behind the websocket connection.