-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Few questions and my idea to get users id for authentication/verification #89
Comments
First this library use socket_select and there is a hardcode limit of 1024 concurrent connections inside php itself you can achieved with one server. To go beyond this limit you'll need to use event poll library as libev or livevent and use a backend other than select. For your idea I'll said first it's not secure ( anyone can enter an allready used id ). Second every connection have their own id inside user data. I suggest you to either use session or built your own authentification ( user will need to enter twice their login&password one for the site and one for websocket ). For communication between every user on your server you'll need to broadcast the message ( send to every connection the message a user send ) |
Thank you Xaraknid for your answer I see that you have made a fork, I will try your fork :) Now you say that my idea is not secure (anyone can enter an already used id) in my website for every user that log in I create PHP-Websockets run in another machine next in function connected ($user) else I close the connection $this->sockets[$user->id] if someone try to make a connection with the same id simply I close connection for him because the specific ID is online, or is not logged. when user close the connection I delete the record is “online” and is available to chat again when he likes. So from my point of view Is pretty ease to allow connections only from the users that have login in to my website and I believe is secure.. well not really but you get the idea. Finally I go to VIRTUAL chat between two users (where still working on that) The idea is when one user clicks to chat with another user I get both of ids and I create a unique chat room, the conversation makes it with json and holds the unique room. Yes I know in telnet everyone can see all chat, but hey, nothing is perfect until someone make it. I'm excited, I wish to knew better php! |
Hello!
First I would like to say that I am new to Websockets and my skills to php are limited, I have a few questions, and I hope to get some answers so to clarify in my mind what and how things works in this server.
So my questions are
I know that is multiple issues, like hardware of server, memory, setup etc.
In socket_listen($this->master,20) this is to connect only 20 users, what if I change SOMAXCONN to 65535?
Can support this php server 65535 connections?
I need (like everyone?) when a user connect to chat to combine with existing user ID
in websockets.php line 199 you have
$user->requestedResource = $headers['get'];
and prints /echobot
if in clients.html create
var host = 'ws://127.0.0.1:9000/'+id;
where id is the unique login id for every user that have successfully log in
if I pass requestedResource to function connected then I can query database for this specific user.
so my idea is
user 101 to connect
var host = 'ws://127.0.0.1:9000/101';
user 102 to connect
var host = 'ws://127.0.0.1:9000/102';
is this correct way to connect?
Thank you!
The text was updated successfully, but these errors were encountered: