orangeable / php-websocket

Enable websockets with PHP to create a simple chat room.
2 stars 0 forks source link

Unreadable input in handshake with WSS #4

Closed BaudouinDrou closed 1 month ago

BaudouinDrou commented 1 month ago

Hi, When using perform_handshaking function over a TLS connection only the hostname and http/1.1 is readable. The rest seems encrypted. Here is what the headers looks like:

d�����X {�D�.�)��� ��<��"���&3���0M��@��4� ����"�+�/̨̩�,�0� � ����/5"MY_HOST_NAME�

# hhttp/1.1" ki 1íU˚G�-�,�W:3C�8�{_���ozK +AT�Ah���og��}-���G�e�h�Z�1���� x ��z$��%�}2��&�I�O��j�%�K!�`ͳ�m2 �Z+�M ��!�3���Lx > -@� ��c�2-Pg��"Ћ��$D+ ��;g����ұ>��Q0�ߵq��B����5j�G� �ͽ��*� ��j�=��s� LS�XNP�ZrG% ~X ��؍��!e�.G�C䠊��e�Zu��>�C

                                                                  H�[���;���WX��x�.�����bf4��������T

��c!���}����#�D�o�!j�ڸY��Y0���3���d����$n"

Because it's not clear text, the handshake fails. Shall I import my certificates to decipher stuff?

orangeable commented 1 month ago

Yup! Check out my tutorial on creating a chat room with JavaScript and websockets. It goes in-depth on the client and server-side setups in a LAMP environment. Once you get through the initial SSL and Apache/virtual host setup, it should fix the issue.