PHP Classes

php mysql websocket chat: I need to create realtime user to user chat

Recommend this page to a friend!
  All requests RSS feed  >  php mysql websocket chat  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

php mysql websocket chat

Edit

Picture of hrushi by hrushi - 7 years ago (2016-09-09)

I need to create realtime user to user chat

This request is clear and relevant.
This request is not clear or is not relevant.

+5

I need help to create user to user chat using php, mysql, jquery & websocket.

I'm writing script for forum which needs something exactly like "GMAIL CHAT".

  • 3 Clarification requests
  • 43. Picture of Neha by Neha - 5 years ago (2018-09-01) Reply

    Hello Johnny,

    I'm using your mysql_websocket_chat and getting error

    PHP Fatal error: Uncaught PDOException: could not find driver in /opt/lampp/htdocs/chat/chat/includes/classes/Database.php:15 Stack trace:

    0 /opt/lampp/htdocs/chat/chat/includes/classes/Database.php(15): PDO->__construct('mysql:dbname=so...', 'root', '', NULL)

    1 /opt/lampp/htdocs/chat/chat/server.php(23): Database->__construct('root', '', 'localhost', 'socket_chat')

    2 {main}

    thrown in /opt/lampp/htdocs/chat/chat/includes/classes/Database.php on line 15

    Please help me out to resolve this error ASAP. I'm working on localhost.

    • 42. Picture of soft test by soft test - 5 years ago (2018-04-30) Reply

      i need create realtime from server to client using php and mysql and websocket

      • 1. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-14) Reply

        is mysql really required? Because you can make a websocket chat really easy if you want.

        • 2. Picture of hrushi by hrushi - 7 years ago (2016-09-14) in reply to comment 1 by Johnny Mast Comment

          mysql is required to "keep chat history".

        • 3. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-15) in reply to comment 2 by hrushi Comment

          Aah well i might have some time in the weekend to spare for a hobby project.

        • 4. Picture of hrushi by hrushi - 7 years ago (2016-09-15) in reply to comment 3 by Johnny Mast Comment

          Thanks. It will be great.

          my simple mysql table contains following fields,

          message_id to_id from_id message time as timestamp ip_address

          Which extra fields are needed?

        • 5. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-15) in reply to comment 4 by hrushi Comment

          that could be it. is message_id your primary auto increment key?

        • 6. Picture of hrushi by hrushi - 7 years ago (2016-09-15) in reply to comment 5 by Johnny Mast Comment

          yup, it locates message if anyone wants to report it as offensive

        • 7. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-16) in reply to comment 6 by hrushi Comment

          Alright let me start on this project.

        • 8. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-16) in reply to comment 6 by hrushi Comment

          you can follow the development here <github.com>/ohnnymast/mysql_websocket_chat

        • 9. Picture of hrushi by hrushi - 7 years ago (2016-09-17) in reply to comment 8 by Johnny Mast Comment

          github.com/ohnnymast/mysql_websocket_chat

          404 Page not found

        • 10. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-17) in reply to comment 9 by hrushi Comment

          it is missing a letter its <github.com>/johnnymast/mysql_websocket_chat

        • 11. Picture of hrushi by hrushi - 7 years ago (2016-09-17) in reply to comment 10 by Johnny Mast Comment

          Okay, got it Thanks for working on my request

          Fatal error: require(): Failed opening required 'vendor/autoload.php'

        • 12. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-17) in reply to comment 9 by hrushi Comment

          the timestamp unix or mysql ?

        • 13. Picture of hrushi by hrushi - 7 years ago (2016-09-17) in reply to comment 12 by Johnny Mast Comment

          mysql

        • 14. Picture of hrushi by hrushi - 7 years ago (2016-09-17) in reply to comment 12 by Johnny Mast Comment

          Using XAMPP on windows 10 Entrprise 64bit

        • 15. Picture of hrushi by hrushi - 7 years ago (2016-09-17) in reply to comment 12 by Johnny Mast Comment

          (only) For chat style I found this, <br /> themeforest.net/item/themekit-bootstrap-admin-theme-kit/6767145

        • 16. Picture of hrushi by hrushi - 7 years ago (2016-09-17) in reply to comment 12 by Johnny Mast Comment

          Exact link is, themekit-v4.themekit.io/dist/themes/social-1/index.html.

          I will use chat styling similar to this theme.

        • 17. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-17) in reply to comment 16 by hrushi Comment

          that will be fine you can create the looks how you want. i am going to release the first package now with instructions. It will not have that layout OR private chat as 1 to 1. I will branch the project to create a chatroom + private chat function after i released it.

        • 18. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-17) in reply to comment 9 by hrushi Comment

          Please install composer you will need it. Make sure you install it system wide, the tutorial will require this.

        • 19. Picture of hrushi by hrushi - 7 years ago (2016-09-17) in reply to comment 18 by Johnny Mast Comment

          Okay, Thanks for your help. <br /> My main need is 1 to 1 private chat. After that group chat, anybody can create group & add members(inside one to one chat, exactly like Gmail). <br /> It is similar to gmail chat. There is option while chatting with one person you can add another person directly. <br /> I'm working on "local forum" project having function of "GMAIL CHAT". <br /> Kindly Please check inside Gmail account, to get idea what I'm looking for.

          <strong>Thanks again, I appreciate</strong> 👍👍👍

        • 20. Picture of hrushi by hrushi - 7 years ago (2016-09-17) in reply to comment 18 by Johnny Mast Comment

          please add table to database, CREATE TABLE members (id int(11) NOT NULL AUTO_INCREMENT, usrname VARCHAR(255) NOT NULL )

        • 21. Picture of hrushi by hrushi - 7 years ago (2016-09-17) in reply to comment 18 by Johnny Mast Comment

          Downloaded & installed Composer-Setup.exe. Selected php.exe from server folder during installation.

          I have xampp installed on D drive and project path is, D:\Server\htdocs\code\phpclasses\chat & it appears in browser as, localhost/code/phpclasses/chat/, how to use composer?

        • 22. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-17) in reply to comment 21 by hrushi Comment

          You have to do that on cmd. If you look at the github repo you will see i added documentation for you.

        • 23. Picture of hrushi by hrushi - 7 years ago (2016-09-18) in reply to comment 22 by Johnny Mast Comment

          Okay, it's running now, but there is problem, it is showing error "Error: Currenty there is no connection to the server." ;

          I changed port in config.php "define('CHAT_SERVER_PORT', '9095');"

        • 24. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-18) in reply to comment 23 by hrushi Comment

          and is the server running?

        • 25. Picture of hrushi by hrushi - 7 years ago (2016-09-18) in reply to comment 24 by Johnny Mast Comment

          cursor is blinking with no output in cmd

        • 26. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-18) in reply to comment 25 by hrushi Comment

          We are almost there. I will check this out for a bit. Take out the redbull and fix it.

        • 27. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-18) in reply to comment 18 by Johnny Mast Comment

          Did you try it in chrome? Also what you could try it to run the server as admin just to test.

        • 28. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-18) in reply to comment 25 by hrushi Comment

          Add me on facebook then we can chat about the issues going way quicker then this. Facebook user = johnny.mast.50

        • 29. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-18) in reply to comment 25 by hrushi Comment

          Okey its done with your private chat as well. I will make a installation video of this. Beware it isnt exactly like gmail but it is one on one chat where other users dont receive private messages.

        • 30. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-18) in reply to comment 25 by hrushi Comment

          video ready <youtube.com>/watch?v=tBS5yHnnrj4

        • 31. Picture of hrushi by hrushi - 7 years ago (2016-09-19) in reply to comment 30 by Johnny Mast Comment

          Thank you. Watching your instruction video. I have just made template is it okay to email it?(found your email on github)

        • 32. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-19) in reply to comment 31 by hrushi Comment

          You can always mail me. I wont to any theming i just made a basic class setup that you can use. But if you have any questions you can contact me.

        • 33. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-20) in reply to comment 31 by hrushi Comment

          Is it working for you now? You might want to update the project if it didnt i updated the phpclasses.org code yesterday around 20:00

        • 34. Picture of hrushi by hrushi - 7 years ago (2016-09-20) in reply to comment 33 by Johnny Mast Comment

          Using Private chat. CMD shows "Server running at 0.0.0.0:9595" & localhost shows Error: Currently there is no connection to the server.

          define('CHAT_SERVER_IP', '0.0.0.0'); define('CHAT_SERVER_PORT', '9595');

        • 35. Picture of hrushi by hrushi - 7 years ago (2016-09-20) in reply to comment 33 by Johnny Mast Comment

          cmd :- "D:\Server\htdocs\code\phpclasses\private_chat>php ./server.php Server running at 0.0.0.0:9595" &

          localhost/code/phpclasses/private_chat/

          "Currenty there is no connection to the server."

        • 36. Picture of hrushi by hrushi - 7 years ago (2016-09-20) in reply to comment 33 by Johnny Mast Comment

          experimented with ip & port but same errors occurs again & again.

          Database is not yet connected

          checking without database and different IPs & ports

        • 37. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-20) in reply to comment 36 by hrushi Comment

          Can you try it in Chrome? You can also use the verstaat command on cmd to see if port 9595 is listening.

        • 38. Picture of hrushi by hrushi - 7 years ago (2016-09-20) in reply to comment 37 by Johnny Mast Comment

          I use chrome & Chromium browser & firefox. For web development I use Chromium (V51 (64-bit)).

          in windows dos netstat have this result,

          TCP 127.0.0.1:9595 DESKTOP:0 LISTENING

          (check e-mail)

        • 39. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-20) in reply to comment 38 by hrushi Comment

          Well wat least you know that you can see that the server is listening for connection. I will check my mail now.

        • 40. Picture of hrushi by hrushi - 7 years ago (2016-09-20) in reply to comment 37 by Johnny Mast Comment

          jsfiddle.net/oxch99us/

        • 41. Picture of Johnny Mast by Johnny Mast - 7 years ago (2016-09-20) in reply to comment 40 by hrushi Comment

          Looking good. PS i returned your mail.

      Ask clarification

      1 Recommendation

      PHP MySQL WebSocket Chat: Websocket chat that stores messages in MySQL

      This recommendation solves the problem.
      This recommendation does not solve the problem.

      +4

      Picture of Johnny Mast by Johnny Mast package author package author Reputation 165 - 7 years ago (2016-09-19) Comment

      This is the package.


      Recommend package
      : 
      :