The session ID is available in a cookie, usually named PHPSESSID (depends on the session.name php.ini setting, and can be checked and changed during execution with session_name().
The HTTP headers, including cookies, are available to the WebSocket server when the user is connecting. A responsible WS server should store those headers and make them available to the application through the user object (or connection object, or whatever object stores and uniquely identifies the resource through which to send the message back to the connected client).
Also, note that the PHP session system locks a user's session while it is open. Because WebSocket servers are designed to run continuously, they will never unlock the session on their own.
So, if a user's session is opened in WS, then every single AJAX and normal web request will timeout. That user will not be able to use your site at all.
Also, only one session can be open in a script at a time. If a second user connects to the WS server, then that user will have access to all of the session information of the first user, and no access to their own session. (Kinda a big, giant, gaping security hole.)
Thus, if you open a session, you MUST close the session as soon as possible using session_write_close().
See this previous question and answer for a specific implementation of sessions in a WebSocket server, as an example of what to look for in your implementation. (Note: Some may be tempted to call this question a duplicate. While I'd hope that both questions stay active, I think, of any, that this question here should be the one to stand, because it is more general (does not cover one specific WS server), and the advice given in the last question is going to be obsolete soon, due to active development with that WS server.)
session_save_path()andsession_name()are the same whether you're accessing it through the web or through CLI. Also, most important, do not forget to runsession_write_close()often; especially in a WebSocket server.