php-chat | A multi-user multi-room ratchet server | Chat library

 by   pmill PHP Version: 0.2.0 License: MIT

kandi X-RAY | php-chat Summary

kandi X-RAY | php-chat Summary

php-chat is a PHP library typically used in Messaging, Chat, Docker applications. php-chat has no vulnerabilities, it has a Permissive License and it has low support. However php-chat has 1 bugs. You can download it from GitHub.

A multi-user multi-room ratchet server
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              php-chat has a low active ecosystem.
              It has 25 star(s) with 14 fork(s). There are 8 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 2 open issues and 1 have been closed. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of php-chat is 0.2.0

            kandi-Quality Quality

              php-chat has 1 bugs (0 blocker, 0 critical, 1 major, 0 minor) and 8 code smells.

            kandi-Security Security

              php-chat has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              php-chat code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              php-chat is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              php-chat releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.
              It has 729 lines of code, 74 functions and 15 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed php-chat and discovered the below as its top functions. This is intended to give you an instant insight into php-chat implemented functionality, and help decide if they suit your requirements.
            • Create ConnectedClient
            • Return the field as array .
            • Make the user welcome message .
            • Makes a user connected message .
            • Makes a user disconnected message .
            • Makes message received from client .
            • Get resource id .
            • Set resource id
            • Get the connection .
            • Set the connection
            Get all kandi verified functions for this library.

            php-chat Key Features

            No Key Features are available at this moment for php-chat.

            php-chat Examples and Code Snippets

            No Code Snippets are available at this moment for php-chat.

            Community Discussions

            QUESTION

            Client(JS-Browser) and Server(PHP) communication over IP through Web-Socket
            Asked 2020-Nov-23 at 11:55

            I am new to web-sockets. I am trying to establish communication between client and server through web-socket. I follow the code from this link:

            https://phppot.com/php/simple-php-chat-using-websocket/

            Here is my try:

            1. Client JS side:

            var ws = new WebSocket("ws://myIp:8090");

            1. Server PHP side:

            define('HOST_NAME',"myIP");
            define('PORT',"8090");

            Now in the browser when I go for,

            1. http://localhost:8090: The initial handshake Request Headers in browser:

            Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.9 Cache-Control: no-cache Connection: Upgrade Host: myIP:8090 Origin: http://localhost:8090 Pragma: no-cache Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits Sec-WebSocket-Key: tJ0fWdCEfJCUcmtRCNOJuQ== Sec-WebSocket-Version: 13 Upgrade: websocket User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36

            And Response headers in PHP Server is:

            HTTP/1.1 101 Web Socket Protocol Handshake Upgrade: websocket Connection: Upgrade WebSocket-Origin: myIP WebSocket-Location: ws://myIP:8090/demo/shout.php Sec-WebSocket-Accept:DqaK+Z+jqf1lJ0vj5bIxFi7+EPc=

            As in above both request and response headers upgrade their protocol to web-socket and communication establish successfully.

            1. http://myIP:8090:

            Request Headers are in browser:

            Provisional headers are shown Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.9 Cache-Control: no-cache Connection: Upgrade Host: myIP:8090 Origin: http://myIP:8090 Pragma: no-cache Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits Sec-WebSocket-Key: D73LNcTLB8P6dzPilGipQQ== Sec-WebSocket-Version: 13 Upgrade: websocket User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36

            but the PHP server receives the Request Headers are:

            GET / HTTP/1.1 Host: localhost:8090 Connection: keep-alive Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36 Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9 Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.9 If-None-Match: W/"41e-5e6jpMk0FNkw+DjhkfcoeaiAhE4"

            As seen above the PHP Server does not receive the web-socket upgrade headers sent by the browser. So the server does not receive any Sec-WebSocket-Key in request headers and got this error:

            ErrorException: Undefined index: Sec-WebSocket-Key

            while creating the response headers. I dont know how this can be tackled? How does the Request Headers are getting modified? Have I done something wrong in the setup? And can this setup work to establish the communication on two different PC's? Please Help. Thanks in Advance!

            ...

            ANSWER

            Answered 2020-Nov-23 at 11:55

            After some try here and there I found the way to communicate through Web-sockets in the same or different PC's.

            1. If the server and Client are in the same PC: The case 1 will be worked from the above question.
            2. If the server and client are in the different PC's: In the Client(JS) side set the IP address to the Server PC IP will work.

            Client JS side:

            var ws = new WebSocket("ws://Server_PC_IP:8090");

            Source https://stackoverflow.com/questions/64939778

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install php-chat

            You can download it from GitHub.
            PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/pmill/php-chat.git

          • CLI

            gh repo clone pmill/php-chat

          • sshUrl

            git@github.com:pmill/php-chat.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link