ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
-Server version: 5.5.27 MySQL Community Server (GPL).
Hello everyone,
Before I begin, my experience is:
*Linux user - 12 years
*HTML - 10 years
*PHP + MySQL on an Apache server - 4 years (on and off when I have ideas I want to explore)
*Javascript - Hate it and just use simple things when I have to and usually have to do a refresher course every time before I start using it but I attempted to learn it when I learned HTML.
*Anything to do with sockets and HTML5 - a little over a week.
side note: Was without a computer for about 3 years until a couple months age when I rehabbed this old dell and rescued it from XP Home Edition.
As you can see I am a simple n00b hobbyist and learned everything from online tutorials and examining other people's work.
ON TO THE MEAT...
I am involved in a personal project in learning real time PHP web development. The project I have designed for this experience is a social network site. Among other things I was wanting to create a full duplex real time chat and instant message system, a multi-user real time white board, and some other things using sockets in PHP that will load into the body of a web page "as it happens".
I wish to code all of it from scratch using nothing but PHP5, MySQL5.5, HTML5, and probably a touch of Javascript so I don't want to use things such as node.js or socket.io but rather create my own libraries of classes and functions to handle the stream data (again, this is for learning and easy doesn't teach you anything).
From reading tutorials I have been able to successfully make an echo server that I could telnet into with multiple users and have done some neat things with that but after that is where I get lost.
Once I have the socket server running, how do I connect to it through a web browser for the purpose of real time chat and stuff in my web pages, or can I even do it like that? If I cannot can you please tell me a better direction
I have no problem using PHP to connect to a MySQL database and for dynamic web pages and such but I have never done anything with sockets before about a week ago, much less in PHP. Can anyone please direct me to a How To or Tutorial that explains how to take this to the next level?
BTW, I do have some code that creates the socket server. If anyone thinks it useful I will post it here for your review but in all honesty, at least on this occasion, I doubt that it would influence anything moving forward. It is very simple and less than 30 lines of code.
Lastly, I know that there are better technologies out there for running socket servers. I could just as easily (probably more so) use C++ (I am at about the same level with C++ as I am with PHP) to do the exact same thing but this is what I have chosen to work with. Please respect that and don't try to convince to alter my overall goal of learning how to use sockets with PHP5. I am already aware of these alternatives.
As always, Thank everyone in advance for any and all help you may have to offer.
Had a thought but I am not sure how valid the idea is or how to implement it if it is valid.
Is there a way to use Apache as a sort of socket bridge between a PHP socket server and a browser to establish real time full duplex communication between the two? Or would it be more likely that the socket server open a socket for Apache and a browser to communicate in real time across? As you can see my education in these matters is lacking and I desperately want to understand this.
I'm trying to dog paddle through some deep water here and almost anything that would give me a clue as to which direction I should take from here would be oh so appreciated. I know how to do everything I need to make this project come together minus how to make it in real time using PHP sockets (I think anyway. If not I will learn what I don't know as I realize I don't know it.).
I thought this to be a reputable place but I was wrong. I am ashamed to say I have received help from a Windows user. You people should be ashamed also. I will never again direct someone to LinuxQuestions.org as I have so many times in the past. I will not soil my reputation or sacrifice the good name of Linux again with your site.
I found my answers, no thanks to anyone here. The answer is Websocket! That is all someone would have had to say to save me over a week of anxiety aimlessly scouring the internet for answers (and I don't mind doing that kind of leg work, I don't want anyone doing things for me, but a freakin' hint would have been really nice). I don't know what else to say other than I am embarrassed for you. If you people were 1/100 the quality and integrity that Linux is you would have at least had the balls to either say you don't know or admit you don't care enough to help. But that's your problem, not mine. I have gained my answer but you have lost my patronage and any and all referrals I would have made.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.